summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-02-20 14:48:41 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 17:55:04 +0100
commit0326ccb5feac6eac35ba6254260e2774277cd976 (patch)
tree60f3db9ca8a5bd894e6ee51d5c4a47e467cab2c5 /drivers/usb
parent79595a734a68f768774d3e9ad6b5ad994413c578 (diff)
downloadlinux-stable-0326ccb5feac6eac35ba6254260e2774277cd976.tar.gz
linux-stable-0326ccb5feac6eac35ba6254260e2774277cd976.tar.bz2
linux-stable-0326ccb5feac6eac35ba6254260e2774277cd976.zip
xhci: tegra: Prevent error pointer dereference
During initialization, the host and super-speed power domains will contain an ERR_PTR() encoded error code rather than being NULL. To avoid a crash, use a !IS_ERR_OR_NULL() condition during cleanup. Signed-off-by: Thierry Reding <treding@nvidia.com> Fixes: 6494a9ad86de ("usb: xhci: tegra: Add genpd support") Cc: stable <stable@vger.kernel.org> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-tegra.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 938ff06c0349..efb0cad8710e 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -941,9 +941,9 @@ static void tegra_xusb_powerdomain_remove(struct device *dev,
device_link_del(tegra->genpd_dl_ss);
if (tegra->genpd_dl_host)
device_link_del(tegra->genpd_dl_host);
- if (tegra->genpd_dev_ss)
+ if (!IS_ERR_OR_NULL(tegra->genpd_dev_ss))
dev_pm_domain_detach(tegra->genpd_dev_ss, true);
- if (tegra->genpd_dev_host)
+ if (!IS_ERR_OR_NULL(tegra->genpd_dev_host))
dev_pm_domain_detach(tegra->genpd_dev_host, true);
}