Skip to content

Commit c6ad161

Browse files
dinghaoliusmb49
authored andcommitted
extcon: Fix error handling in extcon_dev_register
BugLink: https://bugs.launchpad.net/bugs/1923869 [ 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> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent a51de0f commit c6ad161

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)