From 610f9c00ce6ed894caf9bb4feb3c026339150233 Mon Sep 17 00:00:00 2001 From: ye xingchen Date: Tue, 23 Aug 2022 07:52:41 +0000 Subject: [PATCH 1/2] mm/slab_common: Remove the unneeded result variable Return the value from __kmem_cache_shrink() directly instead of storing it in another redundant variable. Reported-by: Zeal Robot Signed-off-by: ye xingchen Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka --- mm/slab_common.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 17996649cfe3..0dfa3cfb6be5 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -495,13 +495,9 @@ EXPORT_SYMBOL(kmem_cache_destroy); */ int kmem_cache_shrink(struct kmem_cache *cachep) { - int ret; - - kasan_cache_shrink(cachep); - ret = __kmem_cache_shrink(cachep); - return ret; + return __kmem_cache_shrink(cachep); } EXPORT_SYMBOL(kmem_cache_shrink); From 2bfbb0271a5b48c01c711d1509a422a7244c9eb8 Mon Sep 17 00:00:00 2001 From: ye xingchen Date: Mon, 22 Aug 2022 01:38:30 +0000 Subject: [PATCH 2/2] mm/slub: Remove the unneeded result variable Return the value from attribute->store(s, buf, len) and attribute->show(s, buf) directly instead of storing it in another redundant variable. Reported-by: Zeal Robot Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: ye xingchen Signed-off-by: Vlastimil Babka --- mm/slub.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 862dbd9af4f5..dc59b9e8c66f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5826,7 +5826,6 @@ static ssize_t slab_attr_show(struct kobject *kobj, { struct slab_attribute *attribute; struct kmem_cache *s; - int err; attribute = to_slab_attr(attr); s = to_slab(kobj); @@ -5834,9 +5833,7 @@ static ssize_t slab_attr_show(struct kobject *kobj, if (!attribute->show) return -EIO; - err = attribute->show(s, buf); - - return err; + return attribute->show(s, buf); } static ssize_t slab_attr_store(struct kobject *kobj, @@ -5845,7 +5842,6 @@ static ssize_t slab_attr_store(struct kobject *kobj, { struct slab_attribute *attribute; struct kmem_cache *s; - int err; attribute = to_slab_attr(attr); s = to_slab(kobj); @@ -5853,8 +5849,7 @@ static ssize_t slab_attr_store(struct kobject *kobj, if (!attribute->store) return -EIO; - err = attribute->store(s, buf, len); - return err; + return attribute->store(s, buf, len); } static void kmem_cache_release(struct kobject *k)