mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slab_common: reduce an if statement in create_cache()
Date: Tue, 6 Jun 2023 16:48:04 +0900	[thread overview]
Message-ID: <ZH7ktMtP8ho2/SFT@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <20230606065543.1324-1-thunder.leizhen@huawei.com>

On Tue, Jun 06, 2023 at 02:55:43PM +0800, Zhen Lei wrote:
> Move the 'out:' statement block out of the successful path to avoid
> redundant check on 'err'. The value of 'err' is always zero on success
> and negative on failure.
> 
> No functional changes, no performance improvements, just a little more
> readability.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  mm/slab_common.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 607249785c077e9..f6fe35105774944 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -236,14 +236,12 @@ static struct kmem_cache *create_cache(const char *name,
>  
>  	s->refcount = 1;
>  	list_add(&s->list, &slab_caches);
> -out:
> -	if (err)
> -		return ERR_PTR(err);
>  	return s;
>  
>  out_free_cache:
>  	kmem_cache_free(kmem_cache, s);
> -	goto out;
> +out:
> +	return ERR_PTR(err);
>  }
>  
>  /**

Hi Zhen,
nice cleanup!

Looks correct to me,
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

> -- 
> 2.25.1
> 

-- 
Hyeonggon Yoo

Doing kernel stuff as a hobby
Undergraduate | Chungnam National University
Dept. Computer Science & Engineering

  reply	other threads:[~2023-06-06  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  6:55 Zhen Lei
2023-06-06  7:48 ` Hyeonggon Yoo [this message]
2023-06-06  8:48   ` 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=ZH7ktMtP8ho2/SFT@debian-BULLSEYE-live-builder-AMD64 \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=thunder.leizhen@huawei.com \
    --cc=vbabka@suse.cz \
    /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

all inboxes | Powered by JetHome®