[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210830221000.179369-5-mcgrof@kernel.org>
Date: Mon, 30 Aug 2021 15:09:49 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, justin@...aid.com, geert@...ux-m68k.org,
ulf.hansson@...aro.org, hare@...e.de, tj@...nel.org,
philipp.reisner@...bit.com, lars.ellenberg@...bit.com,
jdike@...toit.com, richard@....at, anton.ivanov@...bridgegreys.com,
johannes.berg@...el.com, chris.obbard@...labora.com,
krisman@...labora.com, zhuyifei1999@...il.com, thehajime@...il.com,
chris@...kel.net, jcmvbkbc@...il.com, tim@...erelk.net
Cc: linux-xtensa@...ux-xtensa.org, linux-um@...ts.infradead.org,
linux-m68k@...ts.linux-m68k.org, drbd-dev@...ts.linbit.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 04/15] drbd: 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@...nel.org>
---
drivers/block/drbd/drbd_main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 55234a558e98..19db80a1e409 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2794,7 +2794,9 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
goto out_idr_remove_vol;
}
- add_disk(disk);
+ err = add_disk(disk);
+ if (err)
+ goto out_cleanup_disk;
/* inherit the connection state */
device->state.conn = first_connection(resource)->cstate;
@@ -2808,6 +2810,8 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
drbd_debugfs_device_add(device);
return NO_ERROR;
+out_cleanup_disk:
+ blk_cleanup_disk(disk);
out_idr_remove_vol:
idr_remove(&connection->peer_devices, vnr);
out_idr_remove_from_resource:
--
2.30.2
Powered by blists - more mailing lists