[PATCH next] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe

Dan Carpenter posted 1 patch 3 months, 1 week ago
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH next] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe
Posted by Dan Carpenter 3 months, 1 week ago
The devm_regmap_field_alloc() function never returns NULL, it returns
error pointers.  Update the error checking to match.

Fixes: 58128aa88867 ("reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index eea56687cd0a..4ecb9acb2641 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -158,8 +158,8 @@ static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev)
 	field.msb = __fls(args[1]);
 
 	pwrrdy = devm_regmap_field_alloc(dev, regmap, field);
-	if (!pwrrdy)
-		return -ENOMEM;
+	if (IS_ERR(pwrrdy))
+		return PTR_ERR(pwrrdy);
 
 	rzg2l_usbphy_ctrl_set_pwrrdy(pwrrdy, true);
 
-- 
2.51.0
Re: [PATCH next] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe
Posted by Philipp Zabel 3 months ago
On Sa, 2025-11-01 at 16:27 +0300, Dan Carpenter wrote:
> The devm_regmap_field_alloc() function never returns NULL, it returns
> error pointers.  Update the error checking to match.
> 
> Fixes: 58128aa88867 ("reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Applied to reset/next, thanks!

[1/1] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe
      https://git.pengutronix.de/cgit/pza/linux/commit/?id=ce2883a0339c

regards
Philipp
Re: [PATCH next] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe
Posted by Claudiu Beznea 3 months, 1 week ago

On 11/1/25 15:27, Dan Carpenter wrote:
> The devm_regmap_field_alloc() function never returns NULL, it returns
> error pointers.  Update the error checking to match.
> 
> Fixes: 58128aa88867 ("reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

> ---
>  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> index eea56687cd0a..4ecb9acb2641 100644
> --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> @@ -158,8 +158,8 @@ static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev)
>  	field.msb = __fls(args[1]);
>  
>  	pwrrdy = devm_regmap_field_alloc(dev, regmap, field);
> -	if (!pwrrdy)
> -		return -ENOMEM;
> +	if (IS_ERR(pwrrdy))
> +		return PTR_ERR(pwrrdy);
>  
>  	rzg2l_usbphy_ctrl_set_pwrrdy(pwrrdy, true);
>