OSDN Git Service

block/rnbd: call kobject_put in the failure path
authorGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Thu, 26 Nov 2020 10:47:22 +0000 (11:47 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 4 Dec 2020 16:41:10 +0000 (09:41 -0700)
commitd3a95ccaaf4df94743a958c90ab85f4703e3a687
tree27546f078a969af51fa659df840c95acad9c5485
parent765c5c56ffde0a555ce69559ab275395fb1a12a9
block/rnbd: call kobject_put in the failure path

Per the comment of kobject_init_and_add, we need to cleanup the memory
by call kobject_put.

Also we need to call kobject_del for the other failure cases if the
kobject_init_and_add doesn't fail.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rnbd/rnbd-clt-sysfs.c
drivers/block/rnbd/rnbd-srv-sysfs.c