summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKang Chen <void0red@gmail.com>2023-02-27 06:14:10 +0300
committerSebastian Reichel <sre@kernel.org>2023-05-16 01:46:53 +0300
commit4cbb0d358883a27e432714b5256f0362946f5e25 (patch)
treece2c8110276dca88ec99d95240b52a0471c3f4c1
parentb2f2a3c9800208b0db2c2e34b05323757117faa2 (diff)
downloadlinux-4cbb0d358883a27e432714b5256f0362946f5e25.tar.xz
power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe
devm_work_autocancel may fail, add a check and return early. Fixes: 0402e8ebb8b86 ("power: supply: mt6360_charger: add MT6360 charger support") Signed-off-by: Kang Chen <void0red@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/mt6360_charger.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
index 92e48e3a4853..1305cba61edd 100644
--- a/drivers/power/supply/mt6360_charger.c
+++ b/drivers/power/supply/mt6360_charger.c
@@ -796,7 +796,9 @@ static int mt6360_charger_probe(struct platform_device *pdev)
mci->vinovp = 6500000;
mutex_init(&mci->chgdet_lock);
platform_set_drvdata(pdev, mci);
- devm_work_autocancel(&pdev->dev, &mci->chrdet_work, mt6360_chrdet_work);
+ ret = devm_work_autocancel(&pdev->dev, &mci->chrdet_work, mt6360_chrdet_work);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Failed to set delayed work\n");
ret = device_property_read_u32(&pdev->dev, "richtek,vinovp-microvolt", &mci->vinovp);
if (ret)