From: Yu-Chun Lin <eleanor15x@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
jserv@ccns.ncku.edu.tw, visitorckw@gmail.com,
Yu-Chun Lin <eleanor15x@gmail.com>,
kernel test robot <lkp@intel.com>
Subject: [PATCH] mm/list_lru: Remove redundant NULL check before kfree()
Date: Fri, 28 Feb 2025 22:18:56 +0800 [thread overview]
Message-ID: <20250228141856.730825-1-eleanor15x@gmail.com> (raw)
The kernel's kfree() documentation states: "If @object is NULL, no
operation is performed." Remove checking for NULL before calling kfree().
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502250720.9ueIb7Xh-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
---
mm/list_lru.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 7d69434c70e0..7c8fb17d9027 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -548,8 +548,7 @@ int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru,
}
xas_unlock_irqrestore(&xas, flags);
} while (xas_nomem(&xas, gfp));
- if (mlru)
- kfree(mlru);
+ kfree(mlru);
} while (pos != memcg && !css_is_dying(&pos->css));
return xas_error(&xas);
--
2.43.0
next reply other threads:[~2025-02-28 14:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 14:18 Yu-Chun Lin [this message]
2025-02-28 16:39 ` Vlastimil Babka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250228141856.730825-1-eleanor15x@gmail.com \
--to=eleanor15x@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=visitorckw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox