linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()
@ 2023-06-22 14:39 Dan Carpenter
  2023-06-22 14:43 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-06-22 14:39 UTC (permalink / raw)
  To: tangbin; +Cc: linux-usb, linux-tegra

Hello Tang Bin,

The patch f08aa7c80dac: "usb: gadget: tegra-xudc: Fix error check in
tegra_xudc_powerdomain_init()" from May 25, 2022, leads to the
following Smatch static checker warning:

drivers/usb/gadget/udc/tegra-xudc.c:3722 tegra_xudc_powerdomain_init() warn: passing zero to 'PTR_ERR'
drivers/usb/gadget/udc/tegra-xudc.c:3729 tegra_xudc_powerdomain_init() warn: passing zero to 'PTR_ERR'

drivers/usb/gadget/udc/tegra-xudc.c
    3715 static int tegra_xudc_powerdomain_init(struct tegra_xudc *xudc)
    3716 {
    3717         struct device *dev = xudc->dev;
    3718         int err;
    3719 
    3720         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;

This commit was done to make static checkers happy, but it's wrong and
will likely break the driver if CONFIG_PM is disabled.  The following
commits have similar issues:

f08aa7c80dac (usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init())
4ea9496cbc95 (opp: Fix error check in dev_pm_opp_attach_genpd())

    3723                 dev_err(dev, "failed to get device power domain: %d\n", err);
    3724                 return err;
    3725         }
    3726 
    3727         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;
    3730                 dev_err(dev, "failed to get SuperSpeed power domain: %d\n", err);
    3731                 return err;
    3732         }
    3733 

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()
  2023-06-22 14:39 [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init() Dan Carpenter
@ 2023-06-22 14:43 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-06-22 14:43 UTC (permalink / raw)
  Cc: linux-usb, linux-tegra

Ok, Tang Bin's email address is dead.  I'll take care of these.  There
was one other one I reported earlier as well.

0f6e8d8c94a8 (venus: pm_helpers: Fix error check in vcodec_domains_get())

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-22 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22 14:39 [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init() Dan Carpenter
2023-06-22 14:43 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).