power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe
Subsystems (2)
PATCH 1/1 power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe
From: Kang Chen <[email protected]>
devm_work_autocancel may fails, add a check and return early.
Signed-off-by Kang Chen <[email protected]>
--- drivers/power/supply/mt6360_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/mt6360_charger.c +3 -1
@@ -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)
Signature · 1 line
2.34.1
Hi,
Quoted 6 lines · On Mon, Feb 27, 2023 at 11:14:10AM +0800, void0red wrote:
From: Kang Chen <[email protected]>
devm_work_autocancelmay fails, add a check and return early.Signed-off-by Kang Chen <[email protected]>---
Thanks, queued to my fixes branch with Fixes tag added.
-- Sebastian
Quoted 21 lines
drivers/power/supply/mt6360_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/power/supply/mt6360_charger.c +3
-1@@ -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)Signature · 1 line
2.34.1