Skip to content

Commit

Permalink
block/rnbd-srv: init err earlier in rnbd_srv_init_module
Browse files Browse the repository at this point in the history
With this, we can remove several lines of code.

Acked-by: Jack Wang <[email protected]>
Signed-off-by: Guoqing Jiang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Guoqing Jiang authored and axboe committed Jun 12, 2023
1 parent 6a12d53 commit d3fc0b4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/block/rnbd/rnbd-srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static struct rtrs_srv_ctx *rtrs_ctx;
static struct rtrs_srv_ops rtrs_ops;
static int __init rnbd_srv_init_module(void)
{
int err;
int err = 0;

BUILD_BUG_ON(sizeof(struct rnbd_msg_hdr) != 4);
BUILD_BUG_ON(sizeof(struct rnbd_msg_sess_info) != 36);
Expand All @@ -821,19 +821,17 @@ static int __init rnbd_srv_init_module(void)
};
rtrs_ctx = rtrs_srv_open(&rtrs_ops, port_nr);
if (IS_ERR(rtrs_ctx)) {
err = PTR_ERR(rtrs_ctx);
pr_err("rtrs_srv_open(), err: %d\n", err);
return err;
return PTR_ERR(rtrs_ctx);
}

err = rnbd_srv_create_sysfs_files();
if (err) {
pr_err("rnbd_srv_create_sysfs_files(), err: %d\n", err);
rtrs_srv_close(rtrs_ctx);
return err;
}

return 0;
return err;
}

static void __exit rnbd_srv_cleanup_module(void)
Expand Down

0 comments on commit d3fc0b4

Please sign in to comment.