diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-14 01:02:47 -0500 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2019-04-05 16:00:06 +0200 |
commit | 75cf4f5aa903604e1bd7bec2c0988d643c6fb946 (patch) | |
tree | 1bb147557aeadd2e10a11b2f0ad97f8b8f1fde0c /drivers/power | |
parent | 077d9951f7c9ef5845fdcf4363d3a4630d142e4f (diff) |
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: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/charger-manager.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 2e8db5e6de0b..a6900aa0d2ed 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -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); |