Commit a8291be6 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

Revert "usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()"

This reverts commit f08aa7c8.

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 driver, the bug means that probe cannot succeed when CONFIG_PM
is disabled.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Fixes: f08aa7c8 ("usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()")
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/ZKQoBa84U/ykEh3C@morotoSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 288b4fa1
......@@ -3718,15 +3718,15 @@ static int tegra_xudc_powerdomain_init(struct tegra_xudc *xudc)
int err;
xudc->genpd_dev_device = dev_pm_domain_attach_by_name(dev, "dev");
if (IS_ERR_OR_NULL(xudc->genpd_dev_device)) {
err = PTR_ERR(xudc->genpd_dev_device) ? : -ENODATA;
if (IS_ERR(xudc->genpd_dev_device)) {
err = PTR_ERR(xudc->genpd_dev_device);
dev_err(dev, "failed to get device power domain: %d\n", err);
return err;
}
xudc->genpd_dev_ss = dev_pm_domain_attach_by_name(dev, "ss");
if (IS_ERR_OR_NULL(xudc->genpd_dev_ss)) {
err = PTR_ERR(xudc->genpd_dev_ss) ? : -ENODATA;
if (IS_ERR(xudc->genpd_dev_ss)) {
err = PTR_ERR(xudc->genpd_dev_ss);
dev_err(dev, "failed to get SuperSpeed power domain: %d\n", err);
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment