Skip to content

Commit 92ec7e7

Browse files
Ivan Abramovsre
authored andcommitted
power: supply: cw2015: Check devm_delayed_work_autocancel() return code
Since devm_delayed_work_autocancel() may fail, add return code check and exit cw_bat_probe() on error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 0cb172a ("power: supply: cw2015: Use device managed API to simplify the code") Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru> Link: https://patch.msgid.link/20251008120711.556021-1-i.abramov@mt-integration.ru Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 6cdc4d4 commit 92ec7e7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/power/supply/cw2015_battery.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,13 @@ static int cw_bat_probe(struct i2c_client *client)
699699
if (!cw_bat->battery_workqueue)
700700
return -ENOMEM;
701701

702-
devm_delayed_work_autocancel(&client->dev, &cw_bat->battery_delay_work, cw_bat_work);
702+
ret = devm_delayed_work_autocancel(&client->dev, &cw_bat->battery_delay_work, cw_bat_work);
703+
if (ret) {
704+
dev_err_probe(&client->dev, ret,
705+
"Failed to register delayed work\n");
706+
return ret;
707+
}
708+
703709
queue_delayed_work(cw_bat->battery_workqueue,
704710
&cw_bat->battery_delay_work, msecs_to_jiffies(10));
705711
return 0;

0 commit comments

Comments
 (0)