mm/list_lru: Remove redundant NULL check before kfree()
Subsystems (2)
PATCH 1/1 mm/list_lru: Remove redundant NULL check before kfree()
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 <[email protected]>
Signed-off-by Yu-Chun Lin <[email protected]>
--- mm/list_lru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/list_lru.c +1 -2
@@ -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);
Signature · 1 line
2.43.0
Quoted 6 lines · Yu-Chun Lin
The kernel's
kfree()documentation states: "If @object is NULL, no operation is performed." Remove checking for NULL before callingkfree().Reported-by kernel test robot <[email protected]>Signed-off-by Yu-Chun Lin <[email protected]>
This is already in mm-unstable:
https://lore.kernel.org/all/[email protected]/
Quoted 18 lines
--- mm/list_lru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)mm/list_lru.c +1
-2@@ -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);