Skip to content

Commit d3bdd1c

Browse files
dinghaoliuchanwoochoi
authored andcommitted
extcon: Fix error handling in extcon_dev_register
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>
1 parent c9570d4 commit d3bdd1c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)