Commit e0cf8410 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Philipp Zabel
Browse files

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: c5b7cd9a ("reset: rzg2l-usbphy-ctrl: Add suspend/resume support")
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 6de23f81
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
}