summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDinghao Liu <dinghao.liu@zju.edu.cn>2021-01-19 16:10:55 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-07 12:04:21 +0200
commit7283a33ffab7f4fbf82f5387af7a5505a9ce3ef6 (patch)
tree676245ef373efa6bd5b057647f59e72ea1992e0b /drivers
parent7e9ed17afd062a4ac5e32e03cdddb011fe1cd002 (diff)
extcon: Fix error handling in extcon_dev_register
[ Upstream commit d3bdd1c3140724967ca4136755538fa7c05c2b4e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/extcon/extcon.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 21a123cadf78..e7fef10bd12c 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -932,6 +932,7 @@ int extcon_dev_register(struct extcon_dev *edev)
sizeof(*edev->nh) * edev->max_supported, GFP_KERNEL);
if (!edev->nh) {
ret = -ENOMEM;
+ device_unregister(&edev->dev);
goto err_dev;
}