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: <stable@vger.kernel.org> Signed-off-by: Pawel Laszczak <pawell@cadence.com> Link: https://lore.kernel.org/r/20220111090737.10345-1-pawell@gli-login.cadence.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ac55d16 commit 79aa3e1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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)