mbox series

[0/4] extcon: Fix wakeup source leaks on device unbind

Message ID 20250406-device-wakeup-leak-extcon-v1-0-8873eca57465@linaro.org
Headers show
Series extcon: Fix wakeup source leaks on device unbind | expand

Message

Krzysztof Kozlowski April 6, 2025, 8:16 p.m. UTC
Device can be unbound, so driver must also release memory for the wakeup
source.  Use devm for driver already having devm interface and manually
disable wakeup for drivers still having remove() callback to keep
consistent ordering of cleanups.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (4):
      extcon: adc-jack: Fix wakeup source leaks on device unbind
      extcon: axp288: Fix wakeup source leaks on device unbind
      extcon: fsa9480: Fix wakeup source leaks on device unbind
      extcon: qcom-spmi-misc: Fix wakeup source leaks on device unbind

 drivers/extcon/extcon-adc-jack.c       | 1 +
 drivers/extcon/extcon-axp288.c         | 2 +-
 drivers/extcon/extcon-fsa9480.c        | 2 +-
 drivers/extcon/extcon-qcom-spmi-misc.c | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
---
base-commit: a4cda136f021ad44b8b52286aafd613030a6db5f
change-id: 20250406-device-wakeup-leak-extcon-dc1d4429a2b4

Best regards,

Comments

Dmitry Baryshkov April 6, 2025, 8:28 p.m. UTC | #1
On Sun, Apr 06, 2025 at 10:16:41PM +0200, Krzysztof Kozlowski wrote:
> Device can be unbound, so driver must also release memory for the wakeup
> source.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/extcon/extcon-fsa9480.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Krzysztof Kozlowski April 6, 2025, 8:43 p.m. UTC | #2
On 06/04/2025 22:27, Dmitry Baryshkov wrote:
> On Sun, Apr 06, 2025 at 10:16:39PM +0200, Krzysztof Kozlowski wrote:
>> Device can be unbound, so driver must also release memory for the wakeup
>> source.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  drivers/extcon/extcon-adc-jack.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
>> index 46c40d85c2ac89599ffbe7b6d11b161b295d5564..d7e4b1418d7e6b242780b3511f2a49def3acb7a6 100644
>> --- a/drivers/extcon/extcon-adc-jack.c
>> +++ b/drivers/extcon/extcon-adc-jack.c
>> @@ -164,6 +164,7 @@ static void adc_jack_remove(struct platform_device *pdev)
>>  {
>>  	struct adc_jack_data *data = platform_get_drvdata(pdev);
>>  
>> +	device_init_wakeup(&pdev->dev, 0);
> 
> s/0/false/

Sure

> 
> It might be better to use devm_ though

Entire driver would need to be converted, otherwise you got entirely
different order of cleanup. I explained this in cover letter.



Best regards,
Krzysztof
Dmitry Baryshkov April 6, 2025, 9:36 p.m. UTC | #3
On Sun, Apr 06, 2025 at 10:43:35PM +0200, Krzysztof Kozlowski wrote:
> On 06/04/2025 22:27, Dmitry Baryshkov wrote:
> > On Sun, Apr 06, 2025 at 10:16:39PM +0200, Krzysztof Kozlowski wrote:
> >> Device can be unbound, so driver must also release memory for the wakeup
> >> source.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >> ---
> >>  drivers/extcon/extcon-adc-jack.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
> >> index 46c40d85c2ac89599ffbe7b6d11b161b295d5564..d7e4b1418d7e6b242780b3511f2a49def3acb7a6 100644
> >> --- a/drivers/extcon/extcon-adc-jack.c
> >> +++ b/drivers/extcon/extcon-adc-jack.c
> >> @@ -164,6 +164,7 @@ static void adc_jack_remove(struct platform_device *pdev)
> >>  {
> >>  	struct adc_jack_data *data = platform_get_drvdata(pdev);
> >>  
> >> +	device_init_wakeup(&pdev->dev, 0);
> > 
> > s/0/false/
> 
> Sure
> 
> > 
> > It might be better to use devm_ though
> 
> Entire driver would need to be converted, otherwise you got entirely
> different order of cleanup. I explained this in cover letter.

Please move this to the commit message. There are enough developers who
skip cover letters.
MyungJoo Ham April 7, 2025, 4:58 a.m. UTC | #4
>Device can be unbound, so driver must also release memory for the wakeup
>source.
>
>Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>---
> drivers/extcon/extcon-adc-jack.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
>index 46c40d85c2ac89599ffbe7b6d11b161b295d5564..d7e4b1418d7e6b242780b3511f2a49def3acb7a6 100644
>--- a/drivers/extcon/extcon-adc-jack.c
>+++ b/drivers/extcon/extcon-adc-jack.c
>@@ -164,6 +164,7 @@ static void adc_jack_remove(struct platform_device *pdev)
> {
> 	struct adc_jack_data *data = platform_get_drvdata(pdev);
> 
>+	device_init_wakeup(&pdev->dev, 0);
> 	free_irq(data->irq, data);
> 	cancel_work_sync(&data->handler.work);
> }

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>


Cheers,
MyungJoo