[PATCH v3 05/14] reset: warn on reset-gpio release

Bartosz Golaszewski posted 14 patches 1 month ago
[PATCH v3 05/14] reset: warn on reset-gpio release
Posted by Bartosz Golaszewski 1 month ago
While we implement an empty .release() callback for reset-gpio (driver
core requires it), this function will never actually be called as nobody
ever removes the device and the last reference is not dropped anywhere.

This is by design - once created, the reset-gpio device stays in memory.
Make the .release() callback emit a warning, should it ever be called
due to a programming bug.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/reset/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 954df36a242e804b639027384700b8d988be0e90..3e55f794d539e4edc99104cb5396cac72ba30618 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -820,7 +820,7 @@ static void __reset_control_put_internal(struct reset_control *rstc)
 
 static void reset_gpio_aux_device_release(struct device *dev)
 {
-
+	WARN("reset-gpio device %s should never have been removed", dev_name(dev));
 }
 
 static int reset_create_gpio_aux_device(struct reset_gpio_lookup *rgpio_dev,

-- 
2.47.3
Re: [PATCH v3 05/14] reset: warn on reset-gpio release
Posted by Philipp Zabel 1 month ago
On Fr, 2026-03-06 at 18:22 +0100, Bartosz Golaszewski wrote:
> While we implement an empty .release() callback for reset-gpio (driver
> core requires it), this function will never actually be called as nobody
> ever removes the device and the last reference is not dropped anywhere.
> 
> This is by design - once created, the reset-gpio device stays in memory.
> Make the .release() callback emit a warning, should it ever be called
> due to a programming bug.
> 
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>  drivers/reset/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 954df36a242e804b639027384700b8d988be0e90..3e55f794d539e4edc99104cb5396cac72ba30618 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -820,7 +820,7 @@ static void __reset_control_put_internal(struct reset_control *rstc)
>  
>  static void reset_gpio_aux_device_release(struct device *dev)
>  {
> -
> +	WARN("reset-gpio device %s should never have been removed", dev_name(dev));

I'll change this to

	WARN(1, "reset-gpio device %s should never have been removed", dev_name(dev));

when applying.

regards
Philipp