From: Kang Chen Date: Mon, 27 Feb 2023 03:14:10 +0000 (+0800) Subject: power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe X-Git-Tag: baikal/aarch64/sdk6.2~47 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=38eafef7bd988d08bde47067075e719ddd4dd77d;p=kernel.git power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe commit 4cbb0d358883a27e432714b5256f0362946f5e25 upstream. devm_work_autocancel may fail, add a check and return early. Fixes: 14ff12c591ab4 ("power: supply: mt6360_charger: add MT6360 charger support") Signed-off-by: Kang Chen Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c index 3abaa72e06683..f1248faf59058 100644 --- a/drivers/power/supply/mt6360_charger.c +++ b/drivers/power/supply/mt6360_charger.c @@ -799,7 +799,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)