* [PATCH] phy: qcom-m31: Fix error code in probe()
@ 2023-09-07 9:54 Dan Carpenter
2023-09-07 10:24 ` Varadarajan Narayanan
2023-09-07 16:23 ` Deepak R Varma
0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-09-07 9:54 UTC (permalink / raw)
To: Varadarajan Narayanan
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, linux-arm-msm, linux-phy, kernel-janitors
This accidentally returns the wrong variable. It should be "qphy->vreg"
instead of "qphy->phy".
Fixes: 08e49af50701 ("phy: qcom: Introduce M31 USB PHY driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
When we're adding new drivers then we should use the new driver
prefix instead of the subsystem prefix. For example:
Bad: [PATCH] phy: qcom: Introduce M31 USB PHY driver
Good: [PATCH] phy: qcom-m31: Introduce M31 USB PHY driver
That way it's obvious to the first person who sends a bugfix
what the driver prefix is.
drivers/phy/qualcomm/phy-qcom-m31.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c b/drivers/phy/qualcomm/phy-qcom-m31.c
index ed08072ca032..99d570f4142a 100644
--- a/drivers/phy/qualcomm/phy-qcom-m31.c
+++ b/drivers/phy/qualcomm/phy-qcom-m31.c
@@ -256,7 +256,7 @@ static int m31usb_phy_probe(struct platform_device *pdev)
qphy->vreg = devm_regulator_get(dev, "vdda-phy");
if (IS_ERR(qphy->vreg))
- return dev_err_probe(dev, PTR_ERR(qphy->phy),
+ return dev_err_probe(dev, PTR_ERR(qphy->vreg),
"failed to get vreg\n");
phy_set_drvdata(qphy->phy, qphy);
--
2.39.2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] phy: qcom-m31: Fix error code in probe()
2023-09-07 9:54 [PATCH] phy: qcom-m31: Fix error code in probe() Dan Carpenter
@ 2023-09-07 10:24 ` Varadarajan Narayanan
2023-09-07 10:29 ` Dan Carpenter
2023-09-07 16:23 ` Deepak R Varma
1 sibling, 1 reply; 5+ messages in thread
From: Varadarajan Narayanan @ 2023-09-07 10:24 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, linux-arm-msm, linux-phy, kernel-janitors
On Thu, Sep 07, 2023 at 12:54:39PM +0300, Dan Carpenter wrote:
> This accidentally returns the wrong variable. It should be "qphy->vreg"
> instead of "qphy->phy".
>
> Fixes: 08e49af50701 ("phy: qcom: Introduce M31 USB PHY driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> When we're adding new drivers then we should use the new driver
> prefix instead of the subsystem prefix. For example:
>
> Bad: [PATCH] phy: qcom: Introduce M31 USB PHY driver
> Good: [PATCH] phy: qcom-m31: Introduce M31 USB PHY driver
>
> That way it's obvious to the first person who sends a bugfix
> what the driver prefix is.
>
> drivers/phy/qualcomm/phy-qcom-m31.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c b/drivers/phy/qualcomm/phy-qcom-m31.c
> index ed08072ca032..99d570f4142a 100644
> --- a/drivers/phy/qualcomm/phy-qcom-m31.c
> +++ b/drivers/phy/qualcomm/phy-qcom-m31.c
> @@ -256,7 +256,7 @@ static int m31usb_phy_probe(struct platform_device *pdev)
>
> qphy->vreg = devm_regulator_get(dev, "vdda-phy");
> if (IS_ERR(qphy->vreg))
> - return dev_err_probe(dev, PTR_ERR(qphy->phy),
> + return dev_err_probe(dev, PTR_ERR(qphy->vreg),
> "failed to get vreg\n");
>
> phy_set_drvdata(qphy->phy, qphy);
> --
> 2.39.2
I believe this is addressed by https://lore.kernel.org/linux-arm-msm/20230824091345.1072650-1-yangyingliang@huawei.com/
Thanks
Varada
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] phy: qcom-m31: Fix error code in probe()
2023-09-07 10:24 ` Varadarajan Narayanan
@ 2023-09-07 10:29 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-09-07 10:29 UTC (permalink / raw)
To: Varadarajan Narayanan
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, linux-arm-msm, linux-phy, kernel-janitors
On Thu, Sep 07, 2023 at 03:54:05PM +0530, Varadarajan Narayanan wrote:
> On Thu, Sep 07, 2023 at 12:54:39PM +0300, Dan Carpenter wrote:
> > This accidentally returns the wrong variable. It should be "qphy->vreg"
> > instead of "qphy->phy".
> >
> > Fixes: 08e49af50701 ("phy: qcom: Introduce M31 USB PHY driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > When we're adding new drivers then we should use the new driver
> > prefix instead of the subsystem prefix. For example:
> >
> > Bad: [PATCH] phy: qcom: Introduce M31 USB PHY driver
> > Good: [PATCH] phy: qcom-m31: Introduce M31 USB PHY driver
> >
> > That way it's obvious to the first person who sends a bugfix
> > what the driver prefix is.
> >
> > drivers/phy/qualcomm/phy-qcom-m31.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c b/drivers/phy/qualcomm/phy-qcom-m31.c
> > index ed08072ca032..99d570f4142a 100644
> > --- a/drivers/phy/qualcomm/phy-qcom-m31.c
> > +++ b/drivers/phy/qualcomm/phy-qcom-m31.c
> > @@ -256,7 +256,7 @@ static int m31usb_phy_probe(struct platform_device *pdev)
> >
> > qphy->vreg = devm_regulator_get(dev, "vdda-phy");
> > if (IS_ERR(qphy->vreg))
> > - return dev_err_probe(dev, PTR_ERR(qphy->phy),
> > + return dev_err_probe(dev, PTR_ERR(qphy->vreg),
> > "failed to get vreg\n");
> >
> > phy_set_drvdata(qphy->phy, qphy);
> > --
> > 2.39.2
>
> I believe this is addressed by https://lore.kernel.org/linux-arm-msm/20230824091345.1072650-1-yangyingliang@huawei.com/
>
Ah, I normally look up these sorts of fixes using the following command
`elinks "http://lore.kernel.org/all/?q=${FUNC}`
before sending but Yang Yingliang's patch wasn't in the first page of
results so I missed it.
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] 5+ messages in thread
* Re: [PATCH] phy: qcom-m31: Fix error code in probe()
2023-09-07 9:54 [PATCH] phy: qcom-m31: Fix error code in probe() Dan Carpenter
2023-09-07 10:24 ` Varadarajan Narayanan
@ 2023-09-07 16:23 ` Deepak R Varma
2023-09-08 7:18 ` Dan Carpenter
1 sibling, 1 reply; 5+ messages in thread
From: Deepak R Varma @ 2023-09-07 16:23 UTC (permalink / raw)
To: Dan Carpenter, Varadarajan Narayanan
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, linux-arm-msm, linux-phy, kernel-janitors
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?
Thanks,
./drv
>
> Fixes: 08e49af50701 ("phy: qcom: Introduce M31 USB PHY driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> When we're adding new drivers then we should use the new driver
> prefix instead of the subsystem prefix. For example:
>
> Bad: [PATCH] phy: qcom: Introduce M31 USB PHY driver
> Good: [PATCH] phy: qcom-m31: Introduce M31 USB PHY driver
>
> That way it's obvious to the first person who sends a bugfix
> what the driver prefix is.
>
> drivers/phy/qualcomm/phy-qcom-m31.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c
> b/drivers/phy/qualcomm/phy-qcom-m31.c
> index ed08072ca032..99d570f4142a 100644
> --- a/drivers/phy/qualcomm/phy-qcom-m31.c
> +++ b/drivers/phy/qualcomm/phy-qcom-m31.c
> @@ -256,7 +256,7 @@ static int m31usb_phy_probe(struct
> platform_device *pdev)
>
> qphy->vreg = devm_regulator_get(dev, "vdda-phy");
> if (IS_ERR(qphy->vreg))
> - return dev_err_probe(dev, PTR_ERR(qphy->phy),
> + return dev_err_probe(dev, PTR_ERR(qphy->vreg),
> "failed to get
> vreg\n");
>
> phy_set_drvdata(qphy->phy, qphy);
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] phy: qcom-m31: Fix error code in probe()
2023-09-07 16:23 ` Deepak R Varma
@ 2023-09-08 7:18 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-09-08 7:18 UTC (permalink / raw)
To: Deepak R Varma
Cc: Varadarajan Narayanan, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Vinod Koul, Kishon Vijay Abraham I, linux-arm-msm, linux-phy,
kernel-janitors
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
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-08 7:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 9:54 [PATCH] phy: qcom-m31: Fix error code in probe() Dan Carpenter
2023-09-07 10:24 ` Varadarajan Narayanan
2023-09-07 10:29 ` Dan Carpenter
2023-09-07 16:23 ` Deepak R Varma
2023-09-08 7:18 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox