Skip to content

Commit 79aa3e1

Browse files
pawellcdnsgregkh
authored andcommitted
usb: cdnsp: Fix segmentation fault in cdns_lost_power function
CDNSP driver read not initialized cdns->otg_v0_regs which lead to segmentation fault. Patch fixes this issue. Fixes: 2cf2581 ("usb: cdns3: add power lost support for system resume") cc: <[email protected]> Signed-off-by: Pawel Laszczak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ac55d16 commit 79aa3e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/cdns3/drd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns)
483483
/* Indicate the cdns3 core was power lost before */
484484
bool cdns_power_is_lost(struct cdns *cdns)
485485
{
486-
if (cdns->version == CDNS3_CONTROLLER_V1) {
487-
if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
486+
if (cdns->version == CDNS3_CONTROLLER_V0) {
487+
if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
488488
return true;
489489
} else {
490-
if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
490+
if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
491491
return true;
492492
}
493493
return false;

0 commit comments

Comments
 (0)