Skip to content

Commit 3b681a1

Browse files
dinghaoliugregkh
authored andcommitted
extcon: Fix error handling in extcon_dev_register
[ Upstream commit d3bdd1c ] When devm_kcalloc() fails, we should execute device_unregister() to unregister edev->dev from system. Fixes: 046050f ("extcon: Update the prototype of extcon_register_notifier() with enum extcon") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 023d139 commit 3b681a1

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/extcon/extcon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ int extcon_dev_register(struct extcon_dev *edev)
12411241
sizeof(*edev->nh), GFP_KERNEL);
12421242
if (!edev->nh) {
12431243
ret = -ENOMEM;
1244+
device_unregister(&edev->dev);
12441245
goto err_dev;
12451246
}
12461247

0 commit comments

Comments
 (0)