Skip to content

Commit e0cf841

Browse files
claudiubezneapH5
authored andcommitted
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: c5b7cd9 ("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>
1 parent 6de23f8 commit e0cf841

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/reset/reset-rzg2l-usbphy-ctrl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ static int rzg2l_usbphy_ctrl_set_pwrrdy(struct regmap_field *pwrrdy,
136136
{
137137
u32 val = power_on ? 0 : 1;
138138

139+
if (!pwrrdy)
140+
return 0;
141+
139142
/* The initialization path guarantees that the mask is 1 bit long. */
140143
return regmap_field_update_bits(pwrrdy, 1, val);
141144
}

0 commit comments

Comments
 (0)