Skip to content

Commit f96c038

Browse files
Xu Yanggregkh
authored andcommitted
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: e1b5d2b ("usb: chipidea: core: handle usb role switch in a common way") cc: <[email protected]> Signed-off-by: Xu Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 74622f0 commit f96c038

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/chipidea/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,12 +1294,12 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci)
12941294
cable_id = &ci->platdata->id_extcon;
12951295
cable_vbus = &ci->platdata->vbus_extcon;
12961296

1297-
if ((!IS_ERR(cable_id->edev) || !IS_ERR(ci->role_switch))
1297+
if ((!IS_ERR(cable_id->edev) || ci->role_switch)
12981298
&& ci->is_otg &&
12991299
(otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS))
13001300
ci_irq(ci);
13011301

1302-
if ((!IS_ERR(cable_vbus->edev) || !IS_ERR(ci->role_switch))
1302+
if ((!IS_ERR(cable_vbus->edev) || ci->role_switch)
13031303
&& ci->is_otg &&
13041304
(otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS))
13051305
ci_irq(ci);

0 commit comments

Comments
 (0)