[PATCH 6.12.y-cip v2 04/17] reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe

Claudiu Beznea <[email protected]> Wed, 8 Jul 2026 11:12:24 +0300
Newsgroups org.cip-project.lists.cip-dev
Message-ID <[email protected]>
From: Dan Carpenter <[email protected]>

commit cea5d43b63b221522f8532a7894149f3d8d11f4b upstream.

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 <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
Signed-off-by: Philipp Zabel <[email protected]>
Signed-off-by: Claudiu Beznea <[email protected]>
---

Changes in v2:
- none

 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 4d51213e59ba..6d8c48d247a0 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.43.0