extcon: Fix error handling in extcon_dev_register
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Tue, 19 Jan 2021 08:10:55 +0000 (16:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Apr 2021 12:47:43 +0000 (14:47 +0200)
commit58073dc536a6b6ff64d72f4d41ee00a67ef6b35a
tree1bc7aaddcadd1875fde316b2129ef095e1b781c2
parente3a3d5005e634620b837b837eb93d09261483277
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>
drivers/extcon/extcon.c