Skip to content

Commit

Permalink
power: supply: mt6360: add a check of devm_work_autocancel in mt6360_…
Browse files Browse the repository at this point in the history
…charger_probe

commit 4cbb0d3 upstream.

devm_work_autocancel may fail, add a check and return early.

Fixes: 0402e8e ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
void0red authored and gregkh committed May 30, 2023
1 parent 5b3090f commit 4905f08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/power/supply/mt6360_charger.c
Expand Up @@ -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)
Expand Down

0 comments on commit 4905f08

Please sign in to comment.