From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DATE_IN_PAST_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69AECC64E75 for ; Wed, 18 Nov 2020 21:34:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BC9C20715 for ; Wed, 18 Nov 2020 21:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbgKRVef (ORCPT ); Wed, 18 Nov 2020 16:34:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:52536 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbgKRVe3 (ORCPT ); Wed, 18 Nov 2020 16:34:29 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4578DB018; Wed, 18 Nov 2020 21:34:24 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 94E761E132C; Wed, 18 Nov 2020 15:42:55 +0100 (CET) Date: Wed, 18 Nov 2020 15:42:55 +0100 From: Jan Kara To: Christoph Hellwig Cc: Jens Axboe , Tejun Heo , Josef Bacik , Konrad Rzeszutek Wilk , Coly Li , Mike Snitzer , dm-devel@redhat.com, Richard Weinberger , Jan Kara , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 09/20] init: cleanup match_dev_by_uuid and match_dev_by_label Message-ID: <20201118144255.GN1981@quack2.suse.cz> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-10-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201118084800.2339180-10-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed 18-11-20 09:47:49, Christoph Hellwig wrote: > Avoid a totally pointless goto label, and use the same style of > comparism for both helpers. > > Signed-off-by: Christoph Hellwig OK. You can add: Reviewed-by: Jan Kara Honza > --- > init/do_mounts.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/init/do_mounts.c b/init/do_mounts.c > index afa26a4028d25e..5879edf083b318 100644 > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -79,15 +79,10 @@ static int match_dev_by_uuid(struct device *dev, const void *data) > const struct uuidcmp *cmp = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info) > - goto no_match; > - > - if (strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) > - goto no_match; > - > + if (!part->info || > + strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) > + return 0; > return 1; > -no_match: > - return 0; > } > > /** > @@ -174,10 +169,9 @@ static int match_dev_by_label(struct device *dev, const void *data) > const char *label = data; > struct hd_struct *part = dev_to_part(dev); > > - if (part->info && !strcmp(label, part->info->volname)) > - return 1; > - > - return 0; > + if (!part->info || strcmp(label, part->info->volname)) > + return 0; > + return 1; > } > > static dev_t devt_from_partlabel(const char *label) > -- > 2.29.2 > -- Jan Kara SUSE Labs, CR