[bug report] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux