提交 1877539d 编写于 作者: D Dinghao Liu 提交者: Zheng Zengkai

extcon: Fix error handling in extcon_dev_register

[ Upstream commit d3bdd1c3 ]

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: NDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e65de288
...@@ -1256,6 +1256,7 @@ int extcon_dev_register(struct extcon_dev *edev) ...@@ -1256,6 +1256,7 @@ int extcon_dev_register(struct extcon_dev *edev)
sizeof(*edev->nh), GFP_KERNEL); sizeof(*edev->nh), GFP_KERNEL);
if (!edev->nh) { if (!edev->nh) {
ret = -ENOMEM; ret = -ENOMEM;
device_unregister(&edev->dev);
goto err_dev; goto err_dev;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册