Skip to content

Commit a8291be

Browse files
Dan Carpentergregkh
authored andcommitted
Revert "usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()"
This reverts commit f08aa7c. 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: Dan Carpenter <dan.carpenter@linaro.org> Fixes: f08aa7c ("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@moroto Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 288b4fa commit a8291be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/usb/gadget/udc/tegra-xudc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,15 +3718,15 @@ static int tegra_xudc_powerdomain_init(struct tegra_xudc *xudc)
37183718
int err;
37193719

37203720
xudc->genpd_dev_device = dev_pm_domain_attach_by_name(dev, "dev");
3721-
if (IS_ERR_OR_NULL(xudc->genpd_dev_device)) {
3722-
err = PTR_ERR(xudc->genpd_dev_device) ? : -ENODATA;
3721+
if (IS_ERR(xudc->genpd_dev_device)) {
3722+
err = PTR_ERR(xudc->genpd_dev_device);
37233723
dev_err(dev, "failed to get device power domain: %d\n", err);
37243724
return err;
37253725
}
37263726

37273727
xudc->genpd_dev_ss = dev_pm_domain_attach_by_name(dev, "ss");
3728-
if (IS_ERR_OR_NULL(xudc->genpd_dev_ss)) {
3729-
err = PTR_ERR(xudc->genpd_dev_ss) ? : -ENODATA;
3728+
if (IS_ERR(xudc->genpd_dev_ss)) {
3729+
err = PTR_ERR(xudc->genpd_dev_ss);
37303730
dev_err(dev, "failed to get SuperSpeed power domain: %d\n", err);
37313731
return err;
37323732
}

0 commit comments

Comments
 (0)