Skip to contentSkip to conversation

phy: mediatek: fix returning garbage

PATCH In review Tom Rix 5 participants 10 messages Apr 14, 2023 – May 8, 2023

Subsystems (4)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 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")
---
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +3 -3
index abfc077fb0a8..c63294e451d6 100644
@@ -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;
 
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tom Rix

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")
Quoted 21 lines
---
  drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +3 -3
index abfc077fb0a8..c63294e451d6 100644
@@ -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;
 
maintainer
#2 lore raw
Quoted 10 lines · Matthias Brugger
Quoted 7 lines · Tom Rix

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.

Quoted 5 lines
Quoted 2 lines
Fixes 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")

Please also add

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

Regards,
Matthias

Quoted 20 lines
Quoted 20 lines

---
  drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +3 -3
index abfc077fb0a8..c63294e451d6 100644
@@ -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;
Reviewed-by on v1 1/1
#3 lore raw
In reply to Tom Rix
Quoted 9 lines · Tom Rix

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")

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]/

Quoted 24 lines
---
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +3 -3
index abfc077fb0a8..c63294e451d6 100644
@@ -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;
 
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Tom Rix

Il 14/04/23 14:22, Tom Rix ha scritto:

Quoted 9 lines

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")
maintainer
#5 lore raw
In reply to Tom Rix
Quoted 6 lines · Tom Rix

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"

Signature · 1 line
~Vinod
maintainer
#6 lore raw
Quoted 10 lines · Vinod Koul
Quoted 6 lines · Tom Rix

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

maintainer
#7 lore raw
Quoted 11 lines · Matthias Brugger
Quoted 8 lines · Vinod Koul
Quoted 6 lines · Tom Rix

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.

Quoted 6 lines
Quoted 2 lines

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

Signature · 1 line
~Vinod
maintainer
#8 lore raw
Quoted 12 lines · Vinod Koul
Quoted 11 lines · Matthias Brugger
Quoted 8 lines · Vinod Koul
Quoted 6 lines · Tom Rix

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.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

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

maintainer
#9 lore raw
Quoted 22 lines · Matthias Brugger
Quoted 19 lines · Vinod Koul
Quoted 17 lines · Matthias Brugger
Quoted 10 lines · Vinod Koul
Quoted 6 lines · Tom Rix

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?

Quoted 8 lines
Quoted 2 lines

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

Signature · 1 line
~Vinod