diff options
author | Luis Chamberlain | 2021-09-27 15:01:10 -0700 |
---|---|---|
committer | Jens Axboe | 2021-10-18 14:41:36 -0600 |
commit | 3dfdd5f333bf16ec5057d508a574a3302ed84cfa (patch) | |
tree | 98ddaf0009aa7747051350172f86dd5d80754dac | |
parent | b6fa069971bc427e19b8f3882a808f24530994ed (diff) |
pd: add error handling support for add_disk()
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/paride/pd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 500b89a4bdaf..e59759bcf416 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -938,8 +938,12 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, if (ret) goto put_disk; set_capacity(disk->gd, disk->capacity); - add_disk(disk->gd); + ret = add_disk(disk->gd); + if (ret) + goto cleanup_disk; return 0; +cleanup_disk: + blk_cleanup_disk(disk->gd); put_disk: put_disk(p); disk->gd = NULL; |