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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3694AC4332F for ; Mon, 30 Oct 2023 14:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231919AbjJ3Oqc convert rfc822-to-8bit (ORCPT ); Mon, 30 Oct 2023 10:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbjJ3Oqb (ORCPT ); Mon, 30 Oct 2023 10:46:31 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E16BC6 for ; Mon, 30 Oct 2023 07:46:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 24DF36340E17; Mon, 30 Oct 2023 15:46:26 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 83_rsuiJP0iL; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id ABA436340DE6; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id F8QdIGKLfYwY; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 830996342D49; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Date: Mon, 30 Oct 2023 15:46:25 +0100 (CET) From: Richard Weinberger To: hch Cc: Jens Axboe , Miquel Raynal , Vignesh Raghavendra , linux-block , linux-mtd , zhongjinghua@huawei.com, yukuai1@huaweicloud.com Message-ID: <400425098.23787.1698677185386.JavaMail.zimbra@nod.at> In-Reply-To: <20231030140106.1393384-1-hch@lst.de> References: <20231030140106.1393384-1-hch@lst.de> Subject: Re: [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: block: don't use gendisk->first_minor for the idr_alloc return value Thread-Index: z+akUlFSTPw9+Ic4xTj+k92LkiWxmQ== Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org ----- Ursprüngliche Mail ----- > idr_alloc returns an int that is either a negative errno, or the > identifier actually allocated. Use signed integer ret variable to > catch the return value and only assign it to gd->first_minor to prepare > for marking the first_minor field in the gendisk structure as unsigned. > > Signed-off-by: Christoph Hellwig > --- > drivers/mtd/ubi/block.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c > index 437c5b83ffe513..51d00b518d3197 100644 > --- a/drivers/mtd/ubi/block.c > +++ b/drivers/mtd/ubi/block.c > @@ -402,13 +402,14 @@ int ubiblock_create(struct ubi_volume_info *vi) > gd->fops = &ubiblock_ops; > gd->major = ubiblock_major; > gd->minors = 1; > - gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL); > - if (gd->first_minor < 0) { > + ret = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL); > + if (ret < 0) { > dev_err(disk_to_dev(gd), > "block: dynamic minor allocation failed"); > ret = -ENODEV; > goto out_cleanup_disk; > } > + gd->first_minor = ret; Super minor nit, redundant space. Acked-by: Richard Weinberger Thanks, //richard 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBB04C4332F for ; Mon, 30 Oct 2023 14:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Subject:References: In-Reply-To:Message-ID:Cc:To:From:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NZThU6NPPwSMjpghvDARLyfCN6CaJ9CqOnJOrONnUhY=; b=mN4qyyYS7m5pKr+m7eAjqgO3pt HnhBggR/mJnDDjBMKXEPPdyjuz5/IhO6CaRTa827nQu8MZaH267UQWVhZcUc9w0XlB+rZ2f5ibK7N THHD2lBnLBUi6+ULcv8Rw8NjMaM9/6DfbaftjQ5qdu8oirC2tcG9vfollTreZcTYV/m4E2XXPUj// ofMbKdpnUmLwYcnwhFaWsHF5R515LrmyOZqLMV6klqGhc9GNa10zUl4dq/WtWO3NOPSxDvLlbTIRr l3Kb/e+Tiuuad7KwlgzFFaHUj5g5BtWZ0qI9jxpcMpG0Kph4yznevCAnx2oiwlK0ynztdXACIc2V/ 063iWzVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxTXG-003VbY-0e; Mon, 30 Oct 2023 14:46:34 +0000 Received: from lithops.sigma-star.at ([195.201.40.130]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxTXD-003VZf-2R for linux-mtd@lists.infradead.org; Mon, 30 Oct 2023 14:46:33 +0000 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 24DF36340E17; Mon, 30 Oct 2023 15:46:26 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 83_rsuiJP0iL; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id ABA436340DE6; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id F8QdIGKLfYwY; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 830996342D49; Mon, 30 Oct 2023 15:46:25 +0100 (CET) Date: Mon, 30 Oct 2023 15:46:25 +0100 (CET) From: Richard Weinberger To: hch Cc: Jens Axboe , Miquel Raynal , Vignesh Raghavendra , linux-block , linux-mtd , zhongjinghua@huawei.com, yukuai1@huaweicloud.com Message-ID: <400425098.23787.1698677185386.JavaMail.zimbra@nod.at> In-Reply-To: <20231030140106.1393384-1-hch@lst.de> References: <20231030140106.1393384-1-hch@lst.de> Subject: Re: [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value MIME-Version: 1.0 X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: block: don't use gendisk->first_minor for the idr_alloc return value Thread-Index: z+akUlFSTPw9+Ic4xTj+k92LkiWxmQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231030_074631_943642_822769B8 X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org LS0tLS0gVXJzcHLDvG5nbGljaGUgTWFpbCAtLS0tLQo+IGlkcl9hbGxvYyByZXR1cm5zIGFuIGlu dCB0aGF0IGlzIGVpdGhlciBhIG5lZ2F0aXZlIGVycm5vLCBvciB0aGUKPiBpZGVudGlmaWVyIGFj dHVhbGx5IGFsbG9jYXRlZC4gIFVzZSBzaWduZWQgaW50ZWdlciByZXQgdmFyaWFibGUgdG8KPiBj YXRjaCB0aGUgcmV0dXJuIHZhbHVlIGFuZCBvbmx5IGFzc2lnbiBpdCB0byBnZC0+Zmlyc3RfbWlu b3IgdG8gcHJlcGFyZQo+IGZvciBtYXJraW5nIHRoZSBmaXJzdF9taW5vciBmaWVsZCBpbiB0aGUg Z2VuZGlzayBzdHJ1Y3R1cmUgYXMgdW5zaWduZWQuCj4gCj4gU2lnbmVkLW9mZi1ieTogQ2hyaXN0 b3BoIEhlbGx3aWcgPGhjaEBsc3QuZGU+Cj4gLS0tCj4gZHJpdmVycy9tdGQvdWJpL2Jsb2NrLmMg fCA1ICsrKy0tCj4gMSBmaWxlIGNoYW5nZWQsIDMgaW5zZXJ0aW9ucygrKSwgMiBkZWxldGlvbnMo LSkKPiAKPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9tdGQvdWJpL2Jsb2NrLmMgYi9kcml2ZXJzL210 ZC91YmkvYmxvY2suYwo+IGluZGV4IDQzN2M1YjgzZmZlNTEzLi41MWQwMGI1MThkMzE5NyAxMDA2 NDQKPiAtL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