]> git.baikalelectronics.ru Git - kernel.git/commitdiff
usb: xhci: tegra: Fix error check
authorTang Bin <tangbin@cmss.chinamobile.com>
Tue, 24 May 2022 12:14:04 +0000 (20:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:42 +0000 (14:23 +0200)
[ Upstream commit c5ce6d429ca4de913ccd5520a693c00901767c56 ]

In the function tegra_xusb_powerdomain_init(),
dev_pm_domain_attach_by_name() may return NULL in some cases,
so IS_ERR() doesn't meet the requirements. Thus fix it.

Fixes: 68a1ffbd2edd ("usb: xhci: tegra: Add genpd support")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20220524121404.18376-1-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/host/xhci-tegra.c

index 996958a6565c3ade1ea02fed5f3dde94dc116a28..bdb776553826bdd992915daeb5aba850a24d784f 100644 (file)
@@ -1010,15 +1010,15 @@ static int tegra_xusb_powerdomain_init(struct device *dev,
        int err;
 
        tegra->genpd_dev_host = dev_pm_domain_attach_by_name(dev, "xusb_host");
-       if (IS_ERR(tegra->genpd_dev_host)) {
-               err = PTR_ERR(tegra->genpd_dev_host);
+       if (IS_ERR_OR_NULL(tegra->genpd_dev_host)) {
+               err = PTR_ERR(tegra->genpd_dev_host) ? : -ENODATA;
                dev_err(dev, "failed to get host pm-domain: %d\n", err);
                return err;
        }
 
        tegra->genpd_dev_ss = dev_pm_domain_attach_by_name(dev, "xusb_ss");
-       if (IS_ERR(tegra->genpd_dev_ss)) {
-               err = PTR_ERR(tegra->genpd_dev_ss);
+       if (IS_ERR_OR_NULL(tegra->genpd_dev_ss)) {
+               err = PTR_ERR(tegra->genpd_dev_ss) ? : -ENODATA;
                dev_err(dev, "failed to get superspeed pm-domain: %d\n", err);
                return err;
        }