public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	Sebastian Reichel <sre@kernel.org>,
	Chen-Yu Tsai <wens@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 1/4] power: supply: axp288_charger: Do not cancel work before initializing it
Date: Sat, 21 Feb 2026 16:17:11 +0100	[thread overview]
Message-ID: <8a23c0cd-12a8-4c1d-9420-fd029ccf30e0@kernel.org> (raw)
In-Reply-To: <20260220174938.672883-5-krzysztof.kozlowski@oss.qualcomm.com>

Hi,

On 20-Feb-26 18:49, Krzysztof Kozlowski wrote:
> Driver registered devm handler to cancel_work_sync() before even the
> work was initialized, thus leading to possible warning from
> kernel/workqueue.c on (!work->func) check, if the error path was hit
> before the initialization happened.
> 
> Use devm_work_autocancel() on each work item independently, which
> handles the initialization and handler to cancel work.
> 
> Fixes: 165c2357744e ("power: supply: axp288_charger: Properly stop work on probe-error / remove")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans



> ---
>  drivers/power/supply/axp288_charger.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> index ac05942e4e6a..ca52c2c82b2c 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -10,6 +10,7 @@
>  #include <linux/acpi.h>
>  #include <linux/bitops.h>
>  #include <linux/module.h>
> +#include <linux/devm-helpers.h>
>  #include <linux/device.h>
>  #include <linux/regmap.h>
>  #include <linux/workqueue.h>
> @@ -821,14 +822,6 @@ static int charger_init_hw_regs(struct axp288_chrg_info *info)
>  	return 0;
>  }
>  
> -static void axp288_charger_cancel_work(void *data)
> -{
> -	struct axp288_chrg_info *info = data;
> -
> -	cancel_work_sync(&info->otg.work);
> -	cancel_work_sync(&info->cable.work);
> -}
> -
>  static int axp288_charger_probe(struct platform_device *pdev)
>  {
>  	int ret, i, pirq;
> @@ -911,12 +904,12 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Cancel our work on cleanup, register this before the notifiers */
> -	ret = devm_add_action(dev, axp288_charger_cancel_work, info);
> +	ret = devm_work_autocancel(dev, &info->cable.work,
> +				   axp288_charger_extcon_evt_worker);
>  	if (ret)
>  		return ret;
>  
>  	/* Register for extcon notification */
> -	INIT_WORK(&info->cable.work, axp288_charger_extcon_evt_worker);
>  	info->cable.nb.notifier_call = axp288_charger_handle_cable_evt;
>  	ret = devm_extcon_register_notifier_all(dev, info->cable.edev,
>  						&info->cable.nb);
> @@ -926,8 +919,12 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	}
>  	schedule_work(&info->cable.work);
>  
> +	ret = devm_work_autocancel(dev, &info->otg.work,
> +				   axp288_charger_otg_evt_worker);
> +	if (ret)
> +		return ret;
> +
>  	/* Register for OTG notification */
> -	INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker);
>  	info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
>  	if (info->otg.cable) {
>  		ret = devm_extcon_register_notifier(dev, info->otg.cable,


  parent reply	other threads:[~2026-02-21 15:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 17:49 [PATCH 1/4] power: supply: axp288_charger: Do not cancel work before initializing it Krzysztof Kozlowski
2026-02-20 17:49 ` [PATCH 2/4] power: supply: axp288_charger: Simplify returns of dev_err_probe() Krzysztof Kozlowski
2026-02-21  5:05   ` Chen-Yu Tsai
2026-02-21 15:19   ` Hans de Goede
2026-02-20 17:49 ` [PATCH 3/4] power: supply: bq24190: Avoid rescheduling after cancelling work Krzysztof Kozlowski
2026-02-21 15:19   ` Hans de Goede
2026-02-20 17:49 ` [PATCH 4/4] power: supply: twl4030_madc: Drop unused header includes Krzysztof Kozlowski
2026-02-21 15:19   ` Hans de Goede
2026-02-21  5:08 ` [PATCH 1/4] power: supply: axp288_charger: Do not cancel work before initializing it Chen-Yu Tsai
2026-02-21 15:17 ` Hans de Goede [this message]
2026-03-03  0:01 ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a23c0cd-12a8-4c1d-9420-fd029ccf30e0@kernel.org \
    --to=hansg@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox