summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>2026-02-04 16:34:27 +0300
committerPhilipp Zabel <p.zabel@pengutronix.de>2026-02-23 19:03:28 +0300
commite0cf84109bc6c6768337123f1de24ff56b41c91b (patch)
tree04c12f8cc1a5b69bbd0e2f9b2a24b28506d1e6b5
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f (diff)
downloadlinux-e0cf84109bc6c6768337123f1de24ff56b41c91b.tar.xz
reset: rzg2l-usbphy-ctrl: Check pwrrdy is valid before using it
The pwrrdy regmap_filed is allocated in rzg2l_usbphy_ctrl_pwrrdy_init() only if the driver data is set to RZG2L_USBPHY_CTRL_PWRRDY. Check that pwrrdy is valid before using it to avoid "Unable to handle kernel NULL pointer dereference at virtual address" errors. Fixes: c5b7cd9adefc ("reset: rzg2l-usbphy-ctrl: Add suspend/resume support") Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/reset/reset-rzg2l-usbphy-ctrl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 32bc268c9149..05dd9b4a02df 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -136,6 +136,9 @@ static int rzg2l_usbphy_ctrl_set_pwrrdy(struct regmap_field *pwrrdy,
{
u32 val = power_on ? 0 : 1;
+ if (!pwrrdy)
+ return 0;
+
/* The initialization path guarantees that the mask is 1 bit long. */
return regmap_field_update_bits(pwrrdy, 1, val);
}