Commit f96c0384 authored by Xu Yang's avatar Xu Yang Committed by Greg Kroah-Hartman
Browse files

usb: chipidea: core: fix possible constant 0 if use IS_ERR(ci->role_switch)



After successfully probed, ci->role_switch would only be NULL or a valid
pointer. IS_ERR(ci->role_switch) will always return 0. So no need to wrap
it with IS_ERR, otherwise the logic is wrong.

Fixes: e1b5d2be ("usb: chipidea: core: handle usb role switch in a common way")
cc: <stable@vger.kernel.org>
Signed-off-by: default avatarXu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20221215055409.3760523-1-xu.yang_2@nxp.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 74622f0a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1294,12 +1294,12 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci)
	cable_id = &ci->platdata->id_extcon;
	cable_vbus = &ci->platdata->vbus_extcon;

	if ((!IS_ERR(cable_id->edev) || !IS_ERR(ci->role_switch))
	if ((!IS_ERR(cable_id->edev) || ci->role_switch)
		&& ci->is_otg &&
		(otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS))
		ci_irq(ci);

	if ((!IS_ERR(cable_vbus->edev) || !IS_ERR(ci->role_switch))
	if ((!IS_ERR(cable_vbus->edev) || ci->role_switch)
		&& ci->is_otg &&
		(otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS))
		ci_irq(ci);