Skip to contentSkip to conversation

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

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 1, 2025 – Nov 6, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe

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")
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/reset/reset-rzg2l-usbphy-ctrl.c +2 -2
index eea56687cd0a..4ecb9acb2641 100644
@@ -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);
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

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")
Quoted 19 lines
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/reset/reset-rzg2l-usbphy-ctrl.c +2 -2
index eea56687cd0a..4ecb9acb2641 100644
@@ -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);
 
maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

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")

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