mbox series

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

Message ID 20250501-device-wakeup-leak-extcon-v2-0-7af77802cbea@linaro.org
Headers show
Series extcon: Fix wakeup source leaks on device unbind | expand

Message

Krzysztof Kozlowski May 1, 2025, 2:33 p.m. UTC
Changes in v2:
- Patch #1: 0->false, extend commit msg
- Add Rb/Acks
- Link to v1: https://lore.kernel.org/r/20250406-device-wakeup-leak-extcon-v1-0-8873eca57465@linaro.org

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: 393d0c54cae31317deaa9043320c5fd9454deabc
change-id: 20250406-device-wakeup-leak-extcon-dc1d4429a2b4

Best regards,

Comments

Christophe JAILLET May 9, 2025, 7:18 a.m. UTC | #1
Le 09/05/2025 à 09:12, Krzysztof Kozlowski a écrit :
> On 09/05/2025 08:20, Christophe JAILLET wrote:
>>>    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..557930394abd25771799733a22121d1f8e254918 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, false);
>>
>> Hi,
>>
>> Shouldn't this be:
>>
>> 	if (data->wakeup_source)
>> 		device_init_wakeup(&pdev->dev, false);
>>
>> to match how things are done in the probe?
> 
> Yes, it should. I'll fix it.
> 
> Best regards,
> Krzysztof
> 
> 

While at it, maybe also s/1/true/ in device_init_wakeup() in the probe?

CJ