From: Guoqing Jiang Date: Wed, 24 May 2023 07:00:22 +0000 (+0800) Subject: block/rnbd-srv: no need to check sess_dev X-Git-Tag: v6.6.7~2487^2~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba2eed1cf8f08f1e5b1ba009ac22554f14d05342;p=platform%2Fkernel%2Flinux-starfive.git block/rnbd-srv: no need to check sess_dev Check ret is enough since if sess_dev is NULL which also implies ret should be 0. Acked-by: Jack Wang Signed-off-by: Guoqing Jiang Link: https://lore.kernel.org/r/20230524070026.2932-5-guoqing.jiang@linux.dev Signed-off-by: Jens Axboe --- diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 1eb3aec..f610dfc 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -96,7 +96,7 @@ rnbd_get_sess_dev(int dev_id, struct rnbd_srv_session *srv_sess) ret = kref_get_unless_zero(&sess_dev->kref); rcu_read_unlock(); - if (!sess_dev || !ret) + if (!ret) return ERR_PTR(-ENXIO); return sess_dev;