LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	kbusch@kernel.org, sagi@grimberg.me,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Bean Huo (beanhuo)" <beanhuo@micron.com>,
	Avri Altman <avri.altman@wdc.com>,
	Stephen Boyd <swboyd@chromium.org>,
	agk@redhat.com, Mike Snitzer <snitzer@redhat.com>,
	Josef Bacik <josef@toxicpanda.com>,
	Christoph Hellwig <hch@infradead.org>,
	Hannes Reinecke <hare@suse.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Ming Lei <ming.lei@redhat.com>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	linux-nvme@lists.infradead.org,
	linux-mmc <linux-mmc@vger.kernel.org>,
	dm-devel@redhat.com, nbd@other.debian.org,
	linux-block <linux-block@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 4/8] mmc/core/block: add error handling support for add_disk()
Date: Mon, 6 Sep 2021 19:10:10 +0200	[thread overview]
Message-ID: <CAPDyKFp9HTjQ_6c2tHuPhhixfcnFa8XQBrPO2PqoB113BszLJw@mail.gmail.com> (raw)
In-Reply-To: <20210830212538.148729-5-mcgrof@kernel.org>

On Mon, 30 Aug 2021 at 23:26, Luis Chamberlain <mcgrof@kernel.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@kernel.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
>

  reply	other threads:[~2021-09-06 17:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 21:25 [PATCH v3 0/8] block: first batch of add_disk() error handling conversions Luis Chamberlain
2021-08-30 21:25 ` [PATCH v3 1/8] scsi/sd: add error handling support for add_disk() Luis Chamberlain
2021-09-06  6:13   ` Hannes Reinecke
2021-09-07  1:29   ` Ming Lei
2021-09-13 17:21     ` Luis Chamberlain
2021-08-30 21:25 ` [PATCH v3 2/8] scsi/sr: " Luis Chamberlain
2021-09-06  6:13   ` Hannes Reinecke
2021-09-07  1:37   ` Ming Lei
2021-09-13 17:26     ` Luis Chamberlain
2021-08-30 21:25 ` [PATCH v3 3/8] nvme: " Luis Chamberlain
2021-09-06  6:16   ` Hannes Reinecke
2021-09-06  8:09     ` Christoph Hellwig
2021-09-06  8:09   ` Christoph Hellwig
2021-08-30 21:25 ` [PATCH v3 4/8] mmc/core/block: " Luis Chamberlain
2021-09-06 17:10   ` Ulf Hansson [this message]
2021-08-30 21:25 ` [PATCH v3 5/8] md: " Luis Chamberlain
2021-09-06  6:17   ` Hannes Reinecke
2021-08-30 21:25 ` [PATCH v3 6/8] dm: add add_disk() error handling Luis Chamberlain
2021-09-06  6:19   ` Hannes Reinecke
2021-08-30 21:25 ` [PATCH v3 7/8] loop: add error handling support for add_disk() Luis Chamberlain
2021-09-06  6:19   ` Hannes Reinecke
2021-08-30 21:25 ` [PATCH v3 8/8] nbd: " Luis Chamberlain
2021-09-06  6:20   ` Hannes Reinecke

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=CAPDyKFp9HTjQ_6c2tHuPhhixfcnFa8XQBrPO2PqoB113BszLJw@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=agk@redhat.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jejb@linux.ibm.com \
    --cc=josef@toxicpanda.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mcgrof@kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nbd@other.debian.org \
    --cc=sagi@grimberg.me \
    --cc=snitzer@redhat.com \
    --cc=swboyd@chromium.org \
    --subject='Re: [PATCH v3 4/8] mmc/core/block: add error handling support for add_disk()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).