[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9837bbe0-d494-43bb-8e92-8cbf47a32b68@sk.com>
Date: Fri, 2 May 2025 15:46:21 +0900
From: Honggyu Kim <honggyu.kim@...com>
To: Dan Carpenter <dan.carpenter@...aro.org>, Rakie Kim <rakie.kim@...com>
Cc: kernel_team@...ynix.com, Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Joshua Hahn <joshua.hahnjy@...il.com>, Gregory Price <gourry@...rry.net>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] mm/mempolicy: Fix error code in sysfs_wi_node_add()
Hi Dan,
On 4/23/2025 5:24 PM, Dan Carpenter wrote:
> Return -EEXIST if the node already exists. Don't return success.
>
> Fixes: 1bf270ac1b0a ("mm/mempolicy: support memory hotplug in weighted interleave")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> Potentially returning success was intentional? This is from static
> analysis and I can't be totally sure.
>
> mm/mempolicy.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index f43951668c41..0538a994440a 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;
>
> @@ -3569,6 +3569,7 @@ static int sysfs_wi_node_add(int nid)
> if (wi_group->nattrs[nid]) {
> mutex_unlock(&wi_group->kobj_lock);
> pr_info("node%d already exists\n", nid);
> + ret = -EEXIST;
Returning -EEXIST here looks good to me, but could you remove the above pr_info
as well? I mean the following change is needed.
- pr_info("node%d already exists\n", nid)
+ ret = -EEXIST;
We don't need the above pr_info here because we delegate a warning message to
its caller wi_node_notifier().
This can close another warning report below.
https://lore.kernel.org/all/202505020458.yLHRAaW9-lkp@intel.com
If you apply my suggestion then please add
Reviewed-by: Honggyu Kim <honggyu.kim@...com>
Thanks,
Honggyu
> goto out;
> }
>
Powered by blists - more mailing lists