[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFp9HTjQ_6c2tHuPhhixfcnFa8XQBrPO2PqoB113BszLJw@mail.gmail.com>
Date: Mon, 6 Sep 2021 19:10:10 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>, kbusch@...nel.org,
sagi@...mberg.me, Adrian Hunter <adrian.hunter@...el.com>,
"Bean Huo (beanhuo)" <beanhuo@...ron.com>,
Avri Altman <avri.altman@....com>,
Stephen Boyd <swboyd@...omium.org>, agk@...hat.com,
Mike Snitzer <snitzer@...hat.com>,
Josef Bacik <josef@...icpanda.com>,
Christoph Hellwig <hch@...radead.org>,
Hannes Reinecke <hare@...e.de>,
Bart Van Assche <bvanassche@....org>,
Ming Lei <ming.lei@...hat.com>,
linux-scsi <linux-scsi@...r.kernel.org>,
linux-nvme@...ts.infradead.org,
linux-mmc <linux-mmc@...r.kernel.org>, dm-devel@...hat.com,
nbd@...er.debian.org, linux-block <linux-block@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 4/8] mmc/core/block: add error handling support for add_disk()
On Mon, 30 Aug 2021 at 23:26, Luis Chamberlain <mcgrof@...nel.org> wrote:
>
> We never checked for errors on add_disk() as this function
> returned void. Now that this is fixed, use the shiny new
> error handling.
>
> The caller only cleanups the disk if we pass on an allocated md
> but on error we return return ERR_PTR(ret), and so we must do all
> the unwinding ourselves.
>
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
Queued for v5.16 on the temporary devel branch, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/core/block.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 6a15fdf6e5f2..9b2856aa6231 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -2453,9 +2453,14 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
> /* used in ->open, must be set before add_disk: */
> if (area_type == MMC_BLK_DATA_AREA_MAIN)
> dev_set_drvdata(&card->dev, md);
> - device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
> + ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
> + if (ret)
> + goto err_cleanup_queue;
> return md;
>
> + err_cleanup_queue:
> + blk_cleanup_queue(md->disk->queue);
> + blk_mq_free_tag_set(&md->queue.tag_set);
> err_kfree:
> kfree(md);
> out:
> --
> 2.30.2
>
Powered by blists - more mailing lists