linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] mm/mempolicy: Fix error code in sysfs_wi_node_add()
@ 2025-04-23  8:24 Dan Carpenter
  2025-04-23 15:27 ` Joshua Hahn
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dan Carpenter @ 2025-04-23  8:24 UTC (permalink / raw)
  To: Rakie Kim
  Cc: Andrew Morton, Honggyu Kim, Dan Williams, Joshua Hahn,
	Gregory Price, linux-mm, linux-kernel, kernel-janitors

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@linaro.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;
 		goto out;
 	}
 
-- 
2.47.2



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-02  7:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-23  8:24 [PATCH next] mm/mempolicy: Fix error code in sysfs_wi_node_add() Dan Carpenter
2025-04-23 15:27 ` Joshua Hahn
2025-04-23 16:33 ` Gregory Price
2025-04-24  5:49   ` Rakie Kim
2025-05-02  6:46 ` Honggyu Kim
2025-05-02  7:10   ` Dan Carpenter
2025-05-02  7:40     ` Rakie Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox