Commit 75cf4f5a authored by Kangjie Lu's avatar Kangjie Lu Committed by Sebastian Reichel

power: charger-manager: fix a potential NULL pointer dereference

In case create_freezable_workqueue fails, the fix return -ENOMEM
to avoid a potential NULL pointer dereference.
Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 077d9951
......@@ -1987,6 +1987,9 @@ static struct platform_driver charger_manager_driver = {
static int __init charger_manager_init(void)
{
cm_wq = create_freezable_workqueue("charger_manager");
if (unlikely(!cm_wq))
return -ENOMEM;
INIT_DELAYED_WORK(&cm_monitor_work, cm_monitor_poller);
return platform_driver_register(&charger_manager_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment