[PATCH] extcon: adc-jack: Cleanup wakeup source only if it was enabled

Krzysztof Kozlowski posted 1 patch 9 months ago
drivers/extcon/extcon-adc-jack.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] extcon: adc-jack: Cleanup wakeup source only if it was enabled
Posted by Krzysztof Kozlowski 9 months ago
Driver in the probe enables wakeup source conditionally, so the cleanup
path should do the same - do not release the wakeup source memory if it
was not allocated.

Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Closes: https://lore.kernel.org/r/22aaebb7-553b-4571-8a43-58a523241082@wanadoo.fr/
Fixes: 63c223dcdd49 ("extcon: adc-jack: Fix wakeup source leaks on device unbind")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/extcon/extcon-adc-jack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index 557930394abd..7e3c9f38297b 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -164,7 +164,8 @@ static void adc_jack_remove(struct platform_device *pdev)
 {
 	struct adc_jack_data *data = platform_get_drvdata(pdev);
 
-	device_init_wakeup(&pdev->dev, false);
+	if (data->wakeup_source)
+		device_init_wakeup(&pdev->dev, false);
 	free_irq(data->irq, data);
 	cancel_work_sync(&data->handler.work);
 }
-- 
2.45.2
Re: [PATCH] extcon: adc-jack: Cleanup wakeup source only if it was enabled
Posted by Chanwoo Choi 9 months ago
Applied it.

Thanks.

On Fri, May 9, 2025 at 4:18 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Driver in the probe enables wakeup source conditionally, so the cleanup
> path should do the same - do not release the wakeup source memory if it
> was not allocated.
>
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Closes: https://lore.kernel.org/r/22aaebb7-553b-4571-8a43-58a523241082@wanadoo.fr/
> Fixes: 63c223dcdd49 ("extcon: adc-jack: Fix wakeup source leaks on device unbind")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/extcon/extcon-adc-jack.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
> index 557930394abd..7e3c9f38297b 100644
> --- a/drivers/extcon/extcon-adc-jack.c
> +++ b/drivers/extcon/extcon-adc-jack.c
> @@ -164,7 +164,8 @@ static void adc_jack_remove(struct platform_device *pdev)
>  {
>         struct adc_jack_data *data = platform_get_drvdata(pdev);
>
> -       device_init_wakeup(&pdev->dev, false);
> +       if (data->wakeup_source)
> +               device_init_wakeup(&pdev->dev, false);
>         free_irq(data->irq, data);
>         cancel_work_sync(&data->handler.work);
>  }
> --
> 2.45.2
>
>


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics