* [PATCH v2 next] mm/mempolicy: Fix error code in sysfs_wi_node_add()
@ 2025-05-05 14:32 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-05-05 14:32 UTC (permalink / raw)
To: Rakie Kim
Cc: Andrew Morton, Yunjeong Mun, Dan Williams, David Hildenbrand,
Joshua Hahn, linux-mm, linux-kernel, kernel-janitors
Smatch complains that there is a missing error code here. Arguments
could be made either way about what correct behavior should be but
in the end we decided that returning -EINVAL probably made sense.
The wi_node_notifier() already prints an error so this pr_info() is
duplicative so delete it.
Fixes: bc7527e0a127 ("mm/mempolicy: support memory hotplug in weighted interleave")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Reviewed-by: Honggyu Kim <honggyu.kim@sk.com>
Reviewed-by: Rakie Kim <rakie.kim@sk.com>
---
v2: Delete the pr_info() message as well
mm/mempolicy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index f43951668c41..9a2b4b36f558 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3539,7 +3539,7 @@ static const struct kobj_type wi_ktype = {
static int sysfs_wi_node_add(int nid)
{
- int ret = 0;
+ int ret;
char *name;
struct iw_node_attr *new_attr;
@@ -3568,7 +3568,7 @@ static int sysfs_wi_node_add(int nid)
mutex_lock(&wi_group->kobj_lock);
if (wi_group->nattrs[nid]) {
mutex_unlock(&wi_group->kobj_lock);
- pr_info("node%d already exists\n", nid);
+ ret = -EEXIST;
goto out;
}
--
2.47.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-05 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-05 14:32 [PATCH v2 next] mm/mempolicy: Fix error code in sysfs_wi_node_add() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox