Commit d3bdd1c3 authored by Dinghao Liu's avatar Dinghao Liu Committed by Chanwoo Choi
Browse files

extcon: Fix error handling in extcon_dev_register



When devm_kcalloc() fails, we should execute device_unregister()
to unregister edev->dev from system.

Fixes: 046050f6 ("extcon: Update the prototype of extcon_register_notifier() with enum extcon")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent c9570d4a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1241,6 +1241,7 @@ int extcon_dev_register(struct extcon_dev *edev)
				sizeof(*edev->nh), GFP_KERNEL);
	if (!edev->nh) {
		ret = -ENOMEM;
		device_unregister(&edev->dev);
		goto err_dev;
	}