From: Dan Carpenter <dan.carpenter@linaro.org>
To: tangbin@cmss.chinamobile.com
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()
Date: Thu, 22 Jun 2023 17:39:58 +0300 [thread overview]
Message-ID: <8cbe7273-edd2-40c7-8339-1c05d8d74555@moroto.mountain> (raw)
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
next reply other threads:[~2023-06-22 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 14:39 Dan Carpenter [this message]
2023-06-22 14:43 ` [bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init() Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8cbe7273-edd2-40c7-8339-1c05d8d74555@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).