Skip to content

Commit 288b4fa

Browse files
Dan Carpentergregkh
authored andcommitted
Revert "usb: xhci: tegra: Fix error check"
This reverts commit 18fc7c4. The reverted commit was based on static analysis and a misunderstanding of how PTR_ERR() and NULLs are supposed to work. When a function returns both pointer errors and NULL then normally the NULL means "continue operating without a feature because it was deliberately turned off". The NULL should not be treated as a failure. If a driver cannot work when that feature is disabled then the KConfig should enforce that the function cannot return NULL. We should not need to test for it. In this code, the patch means that certain tegra_xusb_probe() will fail if the firmware supports power-domains but CONFIG_PM is disabled. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Fixes: 18fc7c4 ("usb: xhci: tegra: Fix error check") Cc: stable <stable@kernel.org> Link: https://lore.kernel.org/r/8baace8d-fb4b-41a4-ad5f-848ae643a23b@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 83e30f2 commit 288b4fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/usb/host/xhci-tegra.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,15 +1145,15 @@ static int tegra_xusb_powerdomain_init(struct device *dev,
11451145
int err;
11461146

11471147
tegra->genpd_dev_host = dev_pm_domain_attach_by_name(dev, "xusb_host");
1148-
if (IS_ERR_OR_NULL(tegra->genpd_dev_host)) {
1149-
err = PTR_ERR(tegra->genpd_dev_host) ? : -ENODATA;
1148+
if (IS_ERR(tegra->genpd_dev_host)) {
1149+
err = PTR_ERR(tegra->genpd_dev_host);
11501150
dev_err(dev, "failed to get host pm-domain: %d\n", err);
11511151
return err;
11521152
}
11531153

11541154
tegra->genpd_dev_ss = dev_pm_domain_attach_by_name(dev, "xusb_ss");
1155-
if (IS_ERR_OR_NULL(tegra->genpd_dev_ss)) {
1156-
err = PTR_ERR(tegra->genpd_dev_ss) ? : -ENODATA;
1155+
if (IS_ERR(tegra->genpd_dev_ss)) {
1156+
err = PTR_ERR(tegra->genpd_dev_ss);
11571157
dev_err(dev, "failed to get superspeed pm-domain: %d\n", err);
11581158
return err;
11591159
}

0 commit comments

Comments
 (0)