mbox series

[0/9] block: 5th batch of add_disk() error handling conversions

Message ID 20210902174105.2418771-1-mcgrof@kernel.org
Headers show
Series block: 5th batch of add_disk() error handling conversions | expand

Message

Luis Chamberlain Sept. 2, 2021, 5:40 p.m. UTC
This is the 5th of 7 set of driver conversion over to use the new
add_disk() error handling. Please let me know if you spot
any issues. This set deals with miscellaneous block drivers.

This patch set is based on axboe/master, you can find the
full set of changes on my 20210901-for-axboe-add-disk-error-handling
branch [0].

It would seem there are going to be a total of 7 sets of patches. The
next one will be the wonderful and exciting world of floppy drivers.
The last is the required changes to add a __must_check for the return
value for the caller.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20210901-for-axboe-add-disk-error-handling

Luis Chamberlain (9):
  cdrom/gdrom: add error handling support for add_disk()
  ms_block: add error handling support for add_disk()
  mspro_block: add error handling support for add_disk()
  rbd: add add_disk() error handling
  mtd: add add_disk() error handling
  s390/block/dasd_genhd: add error handling support for add_disk()
  s390/block/dcssblk: add error handling support for add_disk()
  s390/block/scm_blk: add error handling support for add_disk()
  s390/block/xpram: add error handling support for add_disk()

 drivers/block/rbd.c                 | 6 +++++-
 drivers/cdrom/gdrom.c               | 7 ++++++-
 drivers/memstick/core/ms_block.c    | 6 +++++-
 drivers/memstick/core/mspro_block.c | 6 +++++-
 drivers/mtd/mtd_blkdevs.c           | 6 +++++-
 drivers/s390/block/dasd_genhd.c     | 8 ++++++--
 drivers/s390/block/dcssblk.c        | 4 +++-
 drivers/s390/block/scm_blk.c        | 7 ++++++-
 drivers/s390/block/xpram.c          | 4 +++-
 9 files changed, 44 insertions(+), 10 deletions(-)

Comments

Heiko Carstens Sept. 3, 2021, 2:30 p.m. UTC | #1
On Thu, Sep 02, 2021 at 10:41:04AM -0700, Luis Chamberlain 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.

> 

> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

> ---

>  drivers/s390/block/scm_blk.c | 7 ++++++-

>  1 file changed, 6 insertions(+), 1 deletion(-)


Acked-by: Heiko Carstens <hca@linux.ibm.com>
Ulf Hansson Sept. 6, 2021, 5:10 p.m. UTC | #2
On Thu, 2 Sept 2021 at 19:41, 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.

>

> Contrary to the typical removal which delays the put_disk()

> until later, since we are failing on a probe we immediately

> put the disk on failure from add_disk by using

> blk_cleanup_disk().

>

> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>


Queued for v5.16 on the temporary devel branch, thanks!

Kind regards
Uffe


> ---

>  drivers/memstick/core/ms_block.c | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c

> index 4a4573fa7b0f..86c626933c1a 100644

> --- a/drivers/memstick/core/ms_block.c

> +++ b/drivers/memstick/core/ms_block.c

> @@ -2156,10 +2156,14 @@ static int msb_init_disk(struct memstick_dev *card)

>                 set_disk_ro(msb->disk, 1);

>

>         msb_start(card);

> -       device_add_disk(&card->dev, msb->disk, NULL);

> +       rc = device_add_disk(&card->dev, msb->disk, NULL);

> +       if (rc)

> +               goto out_cleanup_disk;

>         dbg("Disk added");

>         return 0;

>

> +out_cleanup_disk:

> +       blk_cleanup_disk(msb->disk);

>  out_free_tag_set:

>         blk_mq_free_tag_set(&msb->tag_set);

>  out_release_id:

> --

> 2.30.2

>
Ulf Hansson Sept. 6, 2021, 5:10 p.m. UTC | #3
On Thu, 2 Sept 2021 at 19:41, 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.
>
> Contrary to the typical removal which delays the put_disk()
> until later, since we are failing on a probe we immediately
> put the disk on failure from add_disk by using
> blk_cleanup_disk().
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Queued for v5.16 on the temporary devel branch, thanks!

Kind regards
Uffe


> ---
>  drivers/memstick/core/mspro_block.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
> index 22778d0e24f5..c0450397b673 100644
> --- a/drivers/memstick/core/mspro_block.c
> +++ b/drivers/memstick/core/mspro_block.c
> @@ -1239,10 +1239,14 @@ static int mspro_block_init_disk(struct memstick_dev *card)
>         set_capacity(msb->disk, capacity);
>         dev_dbg(&card->dev, "capacity set %ld\n", capacity);
>
> -       device_add_disk(&card->dev, msb->disk, NULL);
> +       rc = device_add_disk(&card->dev, msb->disk, NULL);
> +       if (rc)
> +               goto out_cleanup_disk;
>         msb->active = 1;
>         return 0;
>
> +out_cleanup_disk:
> +       blk_cleanup_disk(msb->disk);
>  out_free_tag_set:
>         blk_mq_free_tag_set(&msb->tag_set);
>  out_release_id:
> --
> 2.30.2
>