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=unavailable 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 43BEAC8300B for ; Wed, 18 Nov 2020 21:34:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA88B20780 for ; Wed, 18 Nov 2020 21:34:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA88B20780 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 83F296B0070; Wed, 18 Nov 2020 16:34:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A1BE6B0073; Wed, 18 Nov 2020 16:34:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DEE36B0072; Wed, 18 Nov 2020 16:34:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 18E6E6B006E for ; Wed, 18 Nov 2020 16:34:28 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B3B303631 for ; Wed, 18 Nov 2020 21:34:27 +0000 (UTC) X-FDA: 77498842974.01.jam19_4b10fe52733d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 8BE8A1004D442 for ; Wed, 18 Nov 2020 21:34:27 +0000 (UTC) X-HE-Tag: jam19_4b10fe52733d X-Filterd-Recvd-Size: 3005 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Nov 2020 21:34:27 +0000 (UTC) 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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