2023-04-14 12:24:30

by Tom Rix

[permalink] [raw]
Subject: [PATCH] phy: mediatek: fix returning garbage

clang reports
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
'ret' is uninitialized when used here [-Werror,-Wuninitialized]
if (ret)
^~~
ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.

Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
Signed-off-by: Tom Rix <[email protected]>
---
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
index abfc077fb0a8..c63294e451d6 100644
--- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
@@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
if (!(digital_div <= 32 && digital_div >= 1))
return -EINVAL;

- mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
- PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
- txposdiv, digital_div);
+ ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
+ PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
+ txposdiv, digital_div);
if (ret)
return -EINVAL;

--
2.27.0


2023-04-14 15:48:00

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage



On 14/04/2023 14:22, Tom Rix wrote:
> clang reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> if (ret)
> ^~~
> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>
> Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
> Signed-off-by: Tom Rix <[email protected]>

Reviewed-by: Matthias Brugger <[email protected]>

> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..c63294e451d6 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> if (!(digital_div <= 32 && digital_div >= 1))
> return -EINVAL;
>
> - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
> - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
> - txposdiv, digital_div);
> + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
> + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
> + txposdiv, digital_div);
> if (ret)
> return -EINVAL;
>

2023-04-14 15:48:28

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage



On 14/04/2023 17:43, Matthias Brugger wrote:
>
>
> On 14/04/2023 14:22, Tom Rix wrote:
>> clang reports
>> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
>>    'ret' is uninitialized when used here [-Werror,-Wuninitialized]
>>          if (ret)
>>              ^~~
>> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>>
>> Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
>> Signed-off-by: Tom Rix <[email protected]>
>
> Reviewed-by: Matthias Brugger <[email protected]>
>

Please also add
Reported-by: Linux Kernel Functional Testing <[email protected]>

see CA+G9fYu4o0-ZKSthi7kdCjz_kFazZS-rn17Z2NPz3=1Oayr9cw@mail.gmail.com

Regards,
Matthias

>> ---
>>   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
>> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
>> index abfc077fb0a8..c63294e451d6 100644
>> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
>> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
>> @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy
>> *hdmi_phy, struct clk_hw *hw,
>>       if (!(digital_div <= 32 && digital_div >= 1))
>>           return -EINVAL;
>> -    mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
>> -                PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
>> -                txposdiv, digital_div);
>> +    ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
>> +                  PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
>> +                  txposdiv, digital_div);
>>       if (ret)
>>           return -EINVAL;

2023-04-14 15:50:33

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage

On Fri, Apr 14, 2023 at 08:22:53AM -0400, Tom Rix wrote:
> clang reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> if (ret)
> ^~~
> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>
> Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
> Signed-off-by: Tom Rix <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

Angelo brought up a good point on another patch to fix this issue that
we should probably be returning ret instead of unconditionally returning
-EINVAL but it sounds like it does not really matter at the moment since
mtk_hdmi_pll_set_hw() can only return -EINVAL or 0.

https://lore.kernel.org/[email protected]/

> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..c63294e451d6 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> if (!(digital_div <= 32 && digital_div >= 1))
> return -EINVAL;
>
> - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
> - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
> - txposdiv, digital_div);
> + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
> + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
> + txposdiv, digital_div);
> if (ret)
> return -EINVAL;
>
> --
> 2.27.0
>

Subject: Re: [PATCH] phy: mediatek: fix returning garbage

Il 14/04/23 14:22, Tom Rix ha scritto:
> clang reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> if (ret)
> ^~~
> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>
> Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
> Signed-off-by: Tom Rix <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


2023-05-05 09:42:55

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage

On 14-04-23, 08:22, Tom Rix wrote:
> clang reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> if (ret)
> ^~~
> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.

I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable
usage in pll_calc"
--
~Vinod

2023-05-05 15:43:10

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage



On 05/05/2023 11:28, Vinod Koul wrote:
> On 14-04-23, 08:22, Tom Rix wrote:
>> clang reports
>> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
>> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
>> if (ret)
>> ^~~
>> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>
> I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable
> usage in pll_calc"

Thanks Vinod, that was on my list for today as well. I was a bit puzzled because
you took the patch that added it, but I wasn't sure if you would take the fix.
How do you want to handle things like this in the future?

Regards,
Matthias

2023-05-08 08:03:37

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage

On 05-05-23, 17:37, Matthias Brugger wrote:
>
>
> On 05/05/2023 11:28, Vinod Koul wrote:
> > On 14-04-23, 08:22, Tom Rix wrote:
> > > clang reports
> > > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> > > 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> > > if (ret)
> > > ^~~
> > > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
> >
> > I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable
> > usage in pll_calc"
>
> Thanks Vinod, that was on my list for today as well. I was a bit puzzled
> because you took the patch that added it, but I wasn't sure if you would
> take the fix. How do you want to handle things like this in the future?

Fixes should be sent as Fixes patch

--
~Vinod

2023-05-08 08:28:48

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage



On 08/05/2023 09:48, Vinod Koul wrote:
> On 05-05-23, 17:37, Matthias Brugger wrote:
>>
>>
>> On 05/05/2023 11:28, Vinod Koul wrote:
>>> On 14-04-23, 08:22, Tom Rix wrote:
>>>> clang reports
>>>> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
>>>> 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
>>>> if (ret)
>>>> ^~~
>>>> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
>>>
>>> I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable
>>> usage in pll_calc"
>>
>> Thanks Vinod, that was on my list for today as well. I was a bit puzzled
>> because you took the patch that added it, but I wasn't sure if you would
>> take the fix. How do you want to handle things like this in the future?
>
> Fixes should be sent as Fixes patch
>

I'm not sure what do you mean. Patch subject includes the word fix and the patch
has a fixes tag. What was missing here?

Does this mean you will take fixes for this driver in the future or do you want
me to take care of them?

Regards,
Matthias

2023-05-08 09:10:20

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] phy: mediatek: fix returning garbage

On 08-05-23, 10:24, Matthias Brugger wrote:
>
>
> On 08/05/2023 09:48, Vinod Koul wrote:
> > On 05-05-23, 17:37, Matthias Brugger wrote:
> > >
> > >
> > > On 05/05/2023 11:28, Vinod Koul wrote:
> > > > On 14-04-23, 08:22, Tom Rix wrote:
> > > > > clang reports
> > > > > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
> > > > > 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
> > > > > if (ret)
> > > > > ^~~
> > > > > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
> > > >
> > > > I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable
> > > > usage in pll_calc"
> > >
> > > Thanks Vinod, that was on my list for today as well. I was a bit puzzled
> > > because you took the patch that added it, but I wasn't sure if you would
> > > take the fix. How do you want to handle things like this in the future?
> >
> > Fixes should be sent as Fixes patch
> >
>
> I'm not sure what do you mean. Patch subject includes the word fix and the
> patch has a fixes tag. What was missing here?
>
> Does this mean you will take fixes for this driver in the future or do you
> want me to take care of them?

Yes I would take the fixes as well for the drivers

--
~Vinod