Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: Fix error handling in extcon_dev_register

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

Fixes: 046050f6e623e ("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>

authored by

Dinghao Liu and committed by
Chanwoo Choi
d3bdd1c3 c9570d4a

+1
+1
drivers/extcon/extcon.c
··· 1241 1241 sizeof(*edev->nh), GFP_KERNEL); 1242 1242 if (!edev->nh) { 1243 1243 ret = -ENOMEM; 1244 + device_unregister(&edev->dev); 1244 1245 goto err_dev; 1245 1246 } 1246 1247