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@xxxxxxxxxx> Reviewed-by: Joshua Hahn <joshua.hahnjy@xxxxxxxxx> Reviewed-by: Honggyu Kim <honggyu.kim@xxxxxx> Reviewed-by: Rakie Kim <rakie.kim@xxxxxx> --- 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