[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201125124647.30327-1-bobo.shaobowang@huawei.com>
Date: Wed, 25 Nov 2020 20:46:47 +0800
From: Wang ShaoBo <bobo.shaobowang@...wei.com>
To: <danil.kipnis@...ud.ionos.com>
CC: <jinpu.wang@...ud.ionos.com>, <axboe@...nel.dk>,
<linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<huawei.libin@...wei.com>, <cj.chengjian@...wei.com>,
<bobo.shaobowang@...wei.com>
Subject: [PATCH] block/rnbd: server: Fix error return code in rnbd_srv_create_dev_sysfs()
Fix to return -ENOMEM error code from the error handling case where
kobject_create_and_add() failed instead of 0 in rnbd_srv_create_dev_sysfs(),
as done elsewhere in this function.
Signed-off-by: Wang ShaoBo <bobo.shaobowang@...wei.com>
---
drivers/block/rnbd/rnbd-srv-sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/block/rnbd/rnbd-srv-sysfs.c b/drivers/block/rnbd/rnbd-srv-sysfs.c
index 106775c074d1..5ba1a31ad626 100644
--- a/drivers/block/rnbd/rnbd-srv-sysfs.c
+++ b/drivers/block/rnbd/rnbd-srv-sysfs.c
@@ -52,8 +52,10 @@ int rnbd_srv_create_dev_sysfs(struct rnbd_srv_dev *dev,
dev->dev_sessions_kobj = kobject_create_and_add("sessions",
&dev->dev_kobj);
- if (!dev->dev_sessions_kobj)
+ if (!dev->dev_sessions_kobj) {
+ ret = -ENOMEM;
goto put_dev_kobj;
+ }
bdev_kobj = &disk_to_dev(bdev->bd_disk)->kobj;
ret = sysfs_create_link(&dev->dev_kobj, bdev_kobj, "block_dev");
--
2.17.1
Powered by blists - more mailing lists