[PATCH 8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind

Krzysztof Kozlowski posted 8 patches 10 months, 1 week ago
[PATCH 8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind
Posted by Krzysztof Kozlowski 10 months, 1 week ago
Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/sprd-sc27xx-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index 7186e2108108f0d779bfe72d476fa333194c23ca..d6b4350779e6aecfa19d9fa21b9174447d589e33 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -210,7 +210,10 @@ static int sprd_pmic_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	device_init_wakeup(&spi->dev, true);
+	ret = devm_device_init_wakeup(&spi->dev);
+	if (ret)
+		return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
+
 	return 0;
 }
 

-- 
2.45.2
Re: [PATCH 8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind
Posted by Baolin Wang 10 months, 1 week ago

On 2025/4/7 03:50, 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>

Thanks. LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/mfd/sprd-sc27xx-spi.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
> index 7186e2108108f0d779bfe72d476fa333194c23ca..d6b4350779e6aecfa19d9fa21b9174447d589e33 100644
> --- a/drivers/mfd/sprd-sc27xx-spi.c
> +++ b/drivers/mfd/sprd-sc27xx-spi.c
> @@ -210,7 +210,10 @@ static int sprd_pmic_probe(struct spi_device *spi)
>   		return ret;
>   	}
>   
> -	device_init_wakeup(&spi->dev, true);
> +	ret = devm_device_init_wakeup(&spi->dev);
> +	if (ret)
> +		return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
> +
>   	return 0;
>   }
>   
>