diff mbox series

[linux-next] mm/slab_common: Remove the unneeded result variable

Message ID 20220823075241.209009-1-ye.xingchen@zte.com.cn (mailing list archive)
State New
Headers show
Series [linux-next] mm/slab_common: Remove the unneeded result variable | expand

Commit Message

CGEL Aug. 23, 2022, 7:52 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn>

Return the value from __kmem_cache_shrink() directly instead of storing it
 in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 mm/slab_common.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Hyeonggon Yoo Aug. 23, 2022, 8:37 a.m. UTC | #1
On Tue, Aug 23, 2022 at 4:52 PM <cgel.zte@gmail.com> wrote:
>
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Return the value from __kmem_cache_shrink() directly instead of storing it
>  in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  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);
>

Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

> --
> 2.25.1
Vlastimil Babka Aug. 23, 2022, 2:04 p.m. UTC | #2
On 8/23/22 09:52, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Return the value from __kmem_cache_shrink() directly instead of storing it
>  in another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>

Thanks, added to slab.git for-6.1/trivial

> ---
>  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);
>
diff mbox series

Patch

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);