Commit 79aa3e19 authored by Pawel Laszczak's avatar Pawel Laszczak Committed by Greg Kroah-Hartman

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: 2cf2581c ("usb: cdns3: add power lost support for system resume")
cc: <stable@vger.kernel.org>
Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20220111090737.10345-1-pawell@gli-login.cadence.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ac55d163
...@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns) ...@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns)
/* Indicate the cdns3 core was power lost before */ /* Indicate the cdns3 core was power lost before */
bool cdns_power_is_lost(struct cdns *cdns) bool cdns_power_is_lost(struct cdns *cdns)
{ {
if (cdns->version == CDNS3_CONTROLLER_V1) { if (cdns->version == CDNS3_CONTROLLER_V0) {
if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
return true; return true;
} else { } else {
if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
return true; return true;
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment