From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754839AbcIMGrX (ORCPT ); Tue, 13 Sep 2016 02:47:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43256 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751488AbcIMGrW (ORCPT ); Tue, 13 Sep 2016 02:47:22 -0400 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: heiko.carstens@de.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-s390@vger.kernel.org Date: Tue, 13 Sep 2016 08:47:13 +0200 From: Heiko Carstens To: Masahiro Yamada Cc: linux-s390@vger.kernel.org, Michael Holzheu , linux-kernel@vger.kernel.org, Alexander Kuleshov , Martin Schwidefsky Subject: Re: [PATCH] s390: cleanup with list_first_entry_or_null() References: <1473703839-1185-1-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473703839-1185-1-git-send-email-yamada.masahiro@socionext.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091306-0016-0000-0000-000002317710 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091306-0017-0000-0000-000022F960CE Message-Id: <20160913064713.GB4047@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-13_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609130099 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > > 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!