Message ID | 20230523075331.32250-9-guoqing.jiang@linux.dev (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | misc patches for rnbd | expand |
On Tue, May 23, 2023 at 9:53 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote: > > With this, we can remove several lines of code. > > Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> Acked-by: Jack Wang <jinpu.wang@ionos.com> > --- > drivers/block/rnbd/rnbd-srv.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c > index 102831c302fc..1fdf3366135a 100644 > --- a/drivers/block/rnbd/rnbd-srv.c > +++ b/drivers/block/rnbd/rnbd-srv.c > @@ -803,7 +803,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); > @@ -817,19 +817,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) > -- > 2.35.3 >
diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 102831c302fc..1fdf3366135a 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -803,7 +803,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); @@ -817,19 +817,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)
With this, we can remove several lines of code. Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> --- drivers/block/rnbd/rnbd-srv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)