[PATCH] phy: qcom-m31: Fix error code in probe()

Dan Carpenter dan.carpenter at linaro.org
Fri Sep 8 00:18:50 PDT 2023


On Thu, Sep 07, 2023 at 09:53:36PM +0530, Deepak R Varma wrote:
> On Thu, 2023-09-07 at 12:54 +0300, Dan Carpenter wrote:
> > This accidentally returns the wrong variable.  It should be "qphy-
> > >vreg"
> > instead of "qphy->phy".
> 
> Hi Dan,
> Just curious: How did you find this? Visual catch or Static Analyzer?
> 

This was from a Smatch warning.

$ ~/smatch/smatch_scripts/kchecker drivers/phy/qualcomm/phy-qcom-m31.c
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC      drivers/phy/qualcomm/phy-qcom-m31.o
  CHECK   drivers/phy/qualcomm/phy-qcom-m31.c
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:259 m31usb_phy_probe() warn: passing a valid pointer to 'PTR_ERR'
$

regards,
dan carpenter




More information about the linux-phy mailing list