Commit e92ab4ed authored by Luis Chamberlain's avatar Luis Chamberlain Committed by Jens Axboe

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: default avatarLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent d9c2bd25
...@@ -2794,7 +2794,9 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig ...@@ -2794,7 +2794,9 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
goto out_idr_remove_vol; goto out_idr_remove_vol;
} }
add_disk(disk); err = add_disk(disk);
if (err)
goto out_cleanup_disk;
/* inherit the connection state */ /* inherit the connection state */
device->state.conn = first_connection(resource)->cstate; 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 ...@@ -2808,6 +2810,8 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
drbd_debugfs_device_add(device); drbd_debugfs_device_add(device);
return NO_ERROR; return NO_ERROR;
out_cleanup_disk:
blk_cleanup_disk(disk);
out_idr_remove_vol: out_idr_remove_vol:
idr_remove(&connection->peer_devices, vnr); idr_remove(&connection->peer_devices, vnr);
out_idr_remove_from_resource: out_idr_remove_from_resource:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment