summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Laszczak <pawell@cadence.com>2022-01-11 12:07:37 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-01 19:29:07 +0300
commit315f8a59fe1a57e09c3d471d29fbe70aaf9cd988 (patch)
treef62200108d249a5db2c4dee78ad011df912fce04
parent103938dd5798e150689362290274b87af54e3a52 (diff)
downloadlinux-315f8a59fe1a57e09c3d471d29fbe70aaf9cd988.tar.xz
usb: cdnsp: Fix segmentation fault in cdns_lost_power function
commit 79aa3e19fe8f5be30e846df8a436bfe306e8b1a6 upstream. CDNSP driver read not initialized cdns->otg_v0_regs which lead to segmentation fault. Patch fixes this issue. Fixes: 2cf2581cd229 ("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>
-rw-r--r--drivers/usb/cdns3/drd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c
index 55c73b1d8704..d00ff98dffab 100644
--- a/drivers/usb/cdns3/drd.c
+++ b/drivers/usb/cdns3/drd.c
@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns)
/* Indicate the cdns3 core was power lost before */
bool cdns_power_is_lost(struct cdns *cdns)
{
- if (cdns->version == CDNS3_CONTROLLER_V1) {
- if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
+ if (cdns->version == CDNS3_CONTROLLER_V0) {
+ if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
return true;
} else {
- if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
+ if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
return true;
}
return false;