public inbox for linux-phy@lists.infradead.org
 help / color / mirror / Atom feed
* [bug report] phy: qcom: Introduce M31 USB PHY driver
@ 2024-02-06 10:22 Dan Carpenter
  2024-02-07  9:10 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-02-06 10:22 UTC (permalink / raw)
  To: Vinod Koul; +Cc: linux-phy

The patch 08e49af50701: "phy: qcom: Introduce M31 USB PHY driver"
from Aug 14, 2023 (linux-next), leads to the following Smatch static
checker warning:

	drivers/phy/qualcomm/phy-qcom-m31.c:302 m31usb_phy_probe()
	warn: passing zero to 'PTR_ERR'

drivers/phy/qualcomm/phy-qcom-m31.c
    294 
    295         qphy->phy = devm_phy_create(dev, NULL, &m31usb_phy_gen_ops);
    296         if (IS_ERR(qphy->phy))
    297                 return dev_err_probe(dev, PTR_ERR(qphy->phy),
    298                                      "failed to create phy\n");
    299 
    300         qphy->vreg = devm_regulator_get(dev, "vdda-phy");
    301         if (IS_ERR(qphy->vreg))
--> 302                 return dev_err_probe(dev, PTR_ERR(qphy->phy),
                                                                ^^^
This should have been "qphy->vreg".

    303                                      "failed to get vreg\n");
    304 

I can't work out what happened here.

This was fixed in commit 5f7cd740a6b6 ("phy: qcom: phy-qcom-m31: fix
wrong pointer pass to PTR_ERR()") but somehow it got changed back.  I've
looked at the git log and I don't see how that happened...

regards,
dan carpenter

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [bug report] phy: qcom: Introduce M31 USB PHY driver
@ 2023-09-06 11:58 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-09-06 11:58 UTC (permalink / raw)
  To: quic_varada; +Cc: linux-phy

Hello Varadarajan Narayanan,

This is a semi-automatic email about new static checker warnings.

The patch 08e49af50701: "phy: qcom: Introduce M31 USB PHY driver" 
from Aug 14, 2023, leads to the following Smatch complaint:

    drivers/phy/qualcomm/phy-qcom-m31.c:175 m31usb_phy_init()
    warn: variable dereferenced before check 'qphy->vreg' (see line 167)

drivers/phy/qualcomm/phy-qcom-m31.c
   166	
   167		ret = regulator_enable(qphy->vreg);
                                       ^^^^^^^^^^
Unchecked dereference

   168		if (ret) {
   169			dev_err(&phy->dev, "failed to enable regulator, %d\n", ret);
   170			return ret;
   171		}
   172	
   173		ret = clk_prepare_enable(qphy->clk);
   174		if (ret) {
   175			if (qphy->vreg)
                            ^^^^^^^^^^
Checked too late

   176				regulator_disable(qphy->vreg);
   177			dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret);

regards,
dan carpenter

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

end of thread, other threads:[~2024-02-07  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 10:22 [bug report] phy: qcom: Introduce M31 USB PHY driver Dan Carpenter
2024-02-07  9:10 ` Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2023-09-06 11:58 Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox