diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2021-01-19 16:10:55 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-07 14:47:43 +0200 |
commit | 58073dc536a6b6ff64d72f4d41ee00a67ef6b35a (patch) | |
tree | 1bc7aaddcadd1875fde316b2129ef095e1b781c2 /drivers/extcon | |
parent | e3a3d5005e634620b837b837eb93d09261483277 (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/extcon')
-rw-r--r-- | drivers/extcon/extcon.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index e055893fd5c3..5c9e156cd086 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -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; } |