public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: host: Add null check for host_device before accessing its members
@ 2026-01-19  8:22 Abhash Kumar Jha
  2026-01-19  9:33 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Abhash Kumar Jha @ 2026-01-19  8:22 UTC (permalink / raw)
  To: gregkh, pawell, peter.chen
  Cc: linux-arm-kernel, linux-kernel, linux-usb, rogerq, u-kumar1,
	p-mantena, theo.lebrun

In cases when the xhci device is not populated, we see a nullptr
exception when resuming.

Add a nullptr check for the host_dev before accessing its private data.

Fixes: 3a85c1011540 ("usb: host: cdns3: forward lost power information to xhci")
Signed-off-by: Abhash Kumar Jha <a-kumar2@ti.com>
---
 drivers/usb/cdns3/host.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
index f0df114c2b53b..8cc7fc1de6193 100644
--- a/drivers/usb/cdns3/host.c
+++ b/drivers/usb/cdns3/host.c
@@ -141,9 +141,12 @@ static void cdns_host_exit(struct cdns *cdns)
 static int cdns_host_resume(struct cdns *cdns, bool power_lost)
 {
 	struct usb_hcd *hcd = platform_get_drvdata(cdns->host_dev);
-	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+	struct xhci_plat_priv *priv;
 
-	priv->power_lost = power_lost;
+	if (hcd) {
+		priv = hcd_to_xhci_priv(hcd);
+		priv->power_lost = power_lost;
+	}
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-29 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19  8:22 [PATCH] usb: cdns3: host: Add null check for host_device before accessing its members Abhash Kumar Jha
2026-01-19  9:33 ` Greg KH
2026-01-19 11:08 ` Théo Lebrun
2026-01-29 14:34 ` Thomas Richard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox