linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe
@ 2023-02-27  3:14 void0red
  2023-05-15 22:49 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: void0red @ 2023-02-27  3:14 UTC (permalink / raw)
  To: angelogioacchino.delregno
  Cc: sre, matthias.bgg, linux-pm, linux-kernel, linux-arm-kernel,
	linux-mediatek, Kang Chen

From: Kang Chen <void0red@gmail.com>

devm_work_autocancel may fails, add a check and return early.

Signed-off-by: Kang Chen <void0red@gmail.com>
---
 drivers/power/supply/mt6360_charger.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
index 92e48e3a4..1305cba61 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)
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe
  2023-02-27  3:14 [PATCH] power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe void0red
@ 2023-05-15 22:49 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2023-05-15 22:49 UTC (permalink / raw)
  To: void0red
  Cc: angelogioacchino.delregno, matthias.bgg, linux-pm, linux-kernel,
	linux-arm-kernel, linux-mediatek


[-- Attachment #1.1: Type: text/plain, Size: 1214 bytes --]

Hi,

On Mon, Feb 27, 2023 at 11:14:10AM +0800, void0red wrote:
> From: Kang Chen <void0red@gmail.com>
> 
> devm_work_autocancel may fails, add a check and return early.
> 
> Signed-off-by: Kang Chen <void0red@gmail.com>
> ---

Thanks, queued to my fixes branch with Fixes tag added.

-- Sebastian

>  drivers/power/supply/mt6360_charger.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
> index 92e48e3a4..1305cba61 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)
> -- 
> 2.34.1
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-15 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27  3:14 [PATCH] power: supply: mt6360: add a check of devm_work_autocancel in mt6360_charger_probe void0red
2023-05-15 22:49 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).