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 12:47:03 +0200 |
| commit | 2d956c59648288da954b0cc0e008bd21d5f43823 (patch) | |
| tree | 432a96c9054f6333b86642274834a718eab119d9 | |
| parent | 8fb4f3e42f2087d5da7146a3b02bf28b0cdcfd43 (diff) | |
| download | linux-2d956c59648288da954b0cc0e008bd21d5f43823.tar.gz linux-2d956c59648288da954b0cc0e008bd21d5f43823.tar.bz2 linux-2d956c59648288da954b0cc0e008bd21d5f43823.zip | |
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>
| -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 95e96f04bf6f..e9fe3e3bac2b 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1252,6 +1252,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; } |
