[PATCH] mcb: mcb-parse: fix error handing in chameleon_parse_gdd()

Yang Yingliang posted 1 patch 3 years, 5 months ago
drivers/mcb/mcb-parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mcb: mcb-parse: fix error handing in chameleon_parse_gdd()
Posted by Yang Yingliang 3 years, 5 months ago
If mcb_device_register() returns error in chameleon_parse_gdd(), the refcount
of bus and device name are leaked. Fix this by calling put_device() to give up
the reference, so they can be released in mcb_release_dev() and kobject_cleanup().

Fixes: 3764e82e5150 ("drivers: Introduce MEN Chameleon Bus")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mcb/mcb-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c
index 0266bfddfbe2..aa6938da0db8 100644
--- a/drivers/mcb/mcb-parse.c
+++ b/drivers/mcb/mcb-parse.c
@@ -108,7 +108,7 @@ static int chameleon_parse_gdd(struct mcb_bus *bus,
 	return 0;
 
 err:
-	mcb_free_dev(mdev);
+	put_device(&mdev->dev);
 
 	return ret;
 }
-- 
2.25.1
Re: [PATCH] mcb: mcb-parse: fix error handing in chameleon_parse_gdd()
Posted by Johannes Thumshirn 3 years, 5 months ago
Looks good,
Reviewed-by: Johannes Thumshirn <jth@kernel.org>

I'll queue it up