mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
drivers: mcb: fix resource leak in mcb_probe()
[ Upstream commitd723746256
] When probe hook function failed in mcb_probe(), it doesn't put the device. Compiled test only. Fixes:7bc364097a
("mcb: Acquire reference to device in probe") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Signed-off-by: Johannes Thumshirn <jth@kernel.org> Link: https://lore.kernel.org/r/9f87de36bfb85158b506cb78c6fc9db3f6a3bad1.1669624063.git.johannes.thumshirn@wdc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
82e6843266
commit
531ac7b911
1 changed files with 3 additions and 1 deletions
|
@ -74,8 +74,10 @@ static int mcb_probe(struct device *dev)
|
|||
|
||||
get_device(dev);
|
||||
ret = mdrv->probe(mdev, found_id);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
module_put(carrier_mod);
|
||||
put_device(dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue