summaryrefslogtreecommitdiffstats
path: root/drivers/block/rnbd
diff options
context:
space:
mode:
authorGuoqing Jiang <guoqing.jiang@linux.dev>2023-05-24 15:00:25 +0800
committerJens Axboe <axboe@kernel.dk>2023-06-11 19:48:42 -0600
commitd3fc0b46642524bc8e38aed3c7f5e99742436495 (patch)
treea5ed6e899cc84cdc3b724d107554501f57a67425 /drivers/block/rnbd
parent6a12d5379508d530a73140fc7d5502551558ced5 (diff)
downloadlinux-d3fc0b46642524bc8e38aed3c7f5e99742436495.tar.gz
linux-d3fc0b46642524bc8e38aed3c7f5e99742436495.tar.bz2
linux-d3fc0b46642524bc8e38aed3c7f5e99742436495.zip
block/rnbd-srv: init err earlier in rnbd_srv_init_module
With this, we can remove several lines of code. Acked-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> Link: https://lore.kernel.org/r/20230524070026.2932-8-guoqing.jiang@linux.dev Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rnbd')
-rw-r--r--drivers/block/rnbd/rnbd-srv.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index ac66a9bbd3d8..0933e25ea9ab 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -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);
@@ -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)