From: Richard Weinberger <richard@nod.at>
To: hch <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-block <linux-block@vger.kernel.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
zhongjinghua@huawei.com, yukuai1@huaweicloud.com
Subject: Re: [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value
Date: Mon, 30 Oct 2023 15:46:25 +0100 (CET) [thread overview]
Message-ID: <400425098.23787.1698677185386.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20231030140106.1393384-1-hch@lst.de>
----- 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 <hch@lst.de>
> ---
> 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 <richard@nod.at>
Thanks,
//richard
WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: hch <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-block <linux-block@vger.kernel.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
zhongjinghua@huawei.com, yukuai1@huaweicloud.com
Subject: Re: [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value
Date: Mon, 30 Oct 2023 15:46:25 +0100 (CET) [thread overview]
Message-ID: <400425098.23787.1698677185386.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20231030140106.1393384-1-hch@lst.de>
----- 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 <hch@lst.de>
> ---
> 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 <richard@nod.at>
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2023-10-30 14:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 14:01 [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value Christoph Hellwig
2023-10-30 14:01 ` Christoph Hellwig
2023-10-30 14:01 ` [PATCH 2/2] block: dev_t components are unsigned Christoph Hellwig
2023-10-30 14:01 ` Christoph Hellwig
2023-10-30 14:05 ` [PATCH 1/2] ubi: block: don't use gendisk->first_minor for the idr_alloc return value Daniel Golle
2023-10-30 14:05 ` Daniel Golle
2023-10-30 14:46 ` Richard Weinberger [this message]
2023-10-30 14:46 ` Richard Weinberger
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=400425098.23787.1698677185386.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=vigneshr@ti.com \
--cc=yukuai1@huaweicloud.com \
--cc=zhongjinghua@huawei.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.