LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: axboe@kernel.dk, justin@coraid.com, geert@linux-m68k.org,
	ulf.hansson@linaro.org, hare@suse.de, tj@kernel.org,
	philipp.reisner@linbit.com, lars.ellenberg@linbit.com,
	jdike@addtoit.com, richard@nod.at,
	anton.ivanov@cambridgegreys.com, johannes.berg@intel.com,
	chris.obbard@collabora.com, zhuyifei1999@gmail.com,
	thehajime@gmail.com, chris@zankel.net, jcmvbkbc@gmail.com,
	tim@cyberelk.net, linux-xtensa@linux-xtensa.org,
	linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org,
	drbd-dev@lists.linbit.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/15] um/drivers/ubd_kern: add error handling support for add_disk()
Date: Wed, 01 Sep 2021 11:24:55 -0400	[thread overview]
Message-ID: <8735qotj20.fsf@collabora.com> (raw)
In-Reply-To: <20210830221000.179369-6-mcgrof@kernel.org> (Luis Chamberlain's message of "Mon, 30 Aug 2021 15:09:50 -0700")

Luis Chamberlain <mcgrof@kernel.org> writes:

> We never checked for errors on add_disk() as this function
> returned void. Now that this is fixed, use the shiny new
> error handling.
>
> ubd_disk_register() never returned an error, so just fix
> that now and let the caller handle the error condition.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>

> ---
>  arch/um/drivers/ubd_kern.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index cd9dc0556e91..81045c199c30 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -854,8 +854,8 @@ static const struct attribute_group *ubd_attr_groups[] = {
>  	NULL,
>  };
>  
> -static void ubd_disk_register(int major, u64 size, int unit,
> -			      struct gendisk *disk)
> +static int ubd_disk_register(int major, u64 size, int unit,
> +			     struct gendisk *disk)
>  {
>  	disk->major = major;
>  	disk->first_minor = unit << UBD_SHIFT;
> @@ -872,7 +872,7 @@ static void ubd_disk_register(int major, u64 size, int unit,
>  
>  	disk->private_data = &ubd_devs[unit];
>  	disk->queue = ubd_devs[unit].queue;
> -	device_add_disk(&ubd_devs[unit].pdev.dev, disk, ubd_attr_groups);
> +	return device_add_disk(&ubd_devs[unit].pdev.dev, disk, ubd_attr_groups);
>  }
>  
>  #define ROUND_BLOCK(n) ((n + (SECTOR_SIZE - 1)) & (-SECTOR_SIZE))
> @@ -919,10 +919,15 @@ static int ubd_add(int n, char **error_out)
>  	blk_queue_write_cache(ubd_dev->queue, true, false);
>  	blk_queue_max_segments(ubd_dev->queue, MAX_SG);
>  	blk_queue_segment_boundary(ubd_dev->queue, PAGE_SIZE - 1);
> -	ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, disk);
> +	err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, disk);
> +	if (err)
> +		goto out_cleanup_disk;
> +
>  	ubd_gendisk[n] = disk;
>  	return 0;
>  
> +out_cleanup_disk:
> +	blk_cleanup_disk(disk);
>  out_cleanup_tags:
>  	blk_mq_free_tag_set(&ubd_dev->tag_set);
>  out:

-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2021-09-01 15:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 22:09 [PATCH 00/15] block: third batch of add_disk() error handling conversions Luis Chamberlain
2021-08-30 22:09 ` [PATCH 01/15] z2ram: add error handling support for add_disk() Luis Chamberlain
2021-09-01 13:41   ` Geert Uytterhoeven
2021-09-01 19:41     ` Luis Chamberlain
2021-08-30 22:09 ` [PATCH 02/15] aoe: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 03/15] m68k/emu/nfblock: " Luis Chamberlain
2021-09-01 13:43   ` Geert Uytterhoeven
2021-08-30 22:09 ` [PATCH 04/15] drbd: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 05/15] um/drivers/ubd_kern: " Luis Chamberlain
2021-09-01 15:24   ` Gabriel Krisman Bertazi [this message]
2021-08-30 22:09 ` [PATCH 06/15] xtensa/platforms/iss/simdisk: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 07/15] n64cart: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 08/15] pcd: move the identify buffer into pcd_identify Luis Chamberlain
2021-08-30 22:09 ` [PATCH 09/15] pcd: cleanup initialization Luis Chamberlain
2021-08-30 22:09 ` [PATCH 10/15] pf: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 11/15] pd: " Luis Chamberlain
2021-08-30 22:09 ` [PATCH 12/15] pcd: add error handling support for add_disk() Luis Chamberlain
2021-08-30 22:09 ` [PATCH 13/15] pcd: fix ordering of unregister_cdrom() Luis Chamberlain
2021-08-30 22:09 ` [PATCH 14/15] pcd: capture errors on cdrom_register() Luis Chamberlain
2021-08-30 22:10 ` [PATCH 15/15] pd: add error handling support for add_disk() Luis Chamberlain
2021-09-01 19:38   ` Luis Chamberlain

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=8735qotj20.fsf@collabora.com \
    --to=krisman@collabora.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=axboe@kernel.dk \
    --cc=chris.obbard@collabora.com \
    --cc=chris@zankel.net \
    --cc=drbd-dev@lists.linbit.com \
    --cc=geert@linux-m68k.org \
    --cc=hare@suse.de \
    --cc=jcmvbkbc@gmail.com \
    --cc=jdike@addtoit.com \
    --cc=johannes.berg@intel.com \
    --cc=justin@coraid.com \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=mcgrof@kernel.org \
    --cc=philipp.reisner@linbit.com \
    --cc=richard@nod.at \
    --cc=thehajime@gmail.com \
    --cc=tim@cyberelk.net \
    --cc=tj@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=zhuyifei1999@gmail.com \
    --subject='Re: [PATCH 05/15] um/drivers/ubd_kern: 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).