Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8ba4837 authored by Jack Pham's avatar Jack Pham
Browse files

usb: xhci-plat: Prevent NULL access in runtime PM



During cases where runtime PM is invoked before xhci_plat_probe
has not finished initializing, the xhci_hcd member may not be
available yet. Guard against NULL pointer access by no-op'ing
the runtime_suspend/resume functions.

Change-Id: I759196ee187900c57497af7b098675b254fe23f8
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 219364c5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -224,6 +224,9 @@ static int xhci_plat_runtime_suspend(struct device *dev)
	struct usb_hcd *hcd = dev_get_drvdata(dev);
	struct xhci_hcd *xhci = hcd_to_xhci(hcd);

	if (!xhci)
		return 0;

	dev_dbg(dev, "xhci-plat runtime suspend\n");

	return xhci_suspend(xhci);
@@ -234,6 +237,9 @@ static int xhci_plat_runtime_resume(struct device *dev)
	struct usb_hcd *hcd = dev_get_drvdata(dev);
	struct xhci_hcd *xhci = hcd_to_xhci(hcd);

	if (!xhci)
		return 0;

	dev_dbg(dev, "xhci-plat runtime resume\n");

	return xhci_resume(xhci, false);