All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-s390@vger.kernel.org,
	Michael Holzheu <holzheu@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH] s390: cleanup with list_first_entry_or_null()
Date: Tue, 13 Sep 2016 08:47:13 +0200	[thread overview]
Message-ID: <20160913064713.GB4047@osiris> (raw)
In-Reply-To: <1473703839-1185-1-git-send-email-yamada.masahiro@socionext.com>

On Tue, Sep 13, 2016 at 03:10:39AM +0900, Masahiro Yamada wrote:
> The combo of list_empty() check and return list_first_entry()
> can be replaced with list_first_entry_or_null().
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  arch/s390/kernel/crash_dump.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
> index 29df848..621907d 100644
> --- a/arch/s390/kernel/crash_dump.c
> +++ b/arch/s390/kernel/crash_dump.c
> @@ -71,9 +71,8 @@ struct save_area * __init save_area_alloc(bool is_boot_cpu)
>   */
>  struct save_area * __init save_area_boot_cpu(void)
>  {
> -	if (list_empty(&dump_save_areas))
> -		return NULL;
> -	return list_first_entry(&dump_save_areas, struct save_area, list);
> +	return list_first_entry_or_null(&dump_save_areas, struct save_area,
> +					list);

Applied, however without the line break in order to improve readability.

Thanks!

      reply	other threads:[~2016-09-13  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 18:10 [PATCH] s390: cleanup with list_first_entry_or_null() Masahiro Yamada
2016-09-13  6:47 ` Heiko Carstens [this message]

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=20160913064713.GB4047@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=holzheu@linux.vnet.ibm.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.