Skip to content

Commit d723746

Browse files
zhengchaoshaogregkh
authored andcommitted
drivers: mcb: fix resource leak in mcb_probe()
When probe hook function failed in mcb_probe(), it doesn't put the device. Compiled test only. Fixes: 7bc3640 ("mcb: Acquire reference to device in probe") Signed-off-by: Zhengchao Shao <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Link: https://lore.kernel.org/r/9f87de36bfb85158b506cb78c6fc9db3f6a3bad1.1669624063.git.johannes.thumshirn@wdc.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bbb09f8 commit d723746

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/mcb/mcb-core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ static int mcb_probe(struct device *dev)
7171

7272
get_device(dev);
7373
ret = mdrv->probe(mdev, found_id);
74-
if (ret)
74+
if (ret) {
7575
module_put(carrier_mod);
76+
put_device(dev);
77+
}
7678

7779
return ret;
7880
}

0 commit comments

Comments
 (0)