Commit d3fc0b46 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jens Axboe

block/rnbd-srv: init err earlier in rnbd_srv_init_module

With this, we can remove several lines of code.
Acked-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
Link: https://lore.kernel.org/r/20230524070026.2932-8-guoqing.jiang@linux.devSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6a12d537
...@@ -807,7 +807,7 @@ static struct rtrs_srv_ctx *rtrs_ctx; ...@@ -807,7 +807,7 @@ static struct rtrs_srv_ctx *rtrs_ctx;
static struct rtrs_srv_ops rtrs_ops; static struct rtrs_srv_ops rtrs_ops;
static int __init rnbd_srv_init_module(void) 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_hdr) != 4);
BUILD_BUG_ON(sizeof(struct rnbd_msg_sess_info) != 36); BUILD_BUG_ON(sizeof(struct rnbd_msg_sess_info) != 36);
...@@ -821,19 +821,17 @@ static int __init rnbd_srv_init_module(void) ...@@ -821,19 +821,17 @@ static int __init rnbd_srv_init_module(void)
}; };
rtrs_ctx = rtrs_srv_open(&rtrs_ops, port_nr); rtrs_ctx = rtrs_srv_open(&rtrs_ops, port_nr);
if (IS_ERR(rtrs_ctx)) { if (IS_ERR(rtrs_ctx)) {
err = PTR_ERR(rtrs_ctx);
pr_err("rtrs_srv_open(), err: %d\n", err); pr_err("rtrs_srv_open(), err: %d\n", err);
return err; return PTR_ERR(rtrs_ctx);
} }
err = rnbd_srv_create_sysfs_files(); err = rnbd_srv_create_sysfs_files();
if (err) { if (err) {
pr_err("rnbd_srv_create_sysfs_files(), err: %d\n", err); pr_err("rnbd_srv_create_sysfs_files(), err: %d\n", err);
rtrs_srv_close(rtrs_ctx); rtrs_srv_close(rtrs_ctx);
return err;
} }
return 0; return err;
} }
static void __exit rnbd_srv_cleanup_module(void) static void __exit rnbd_srv_cleanup_module(void)
......
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