phy: mediatek: hdmi: mt8195: fix uninitialized variable usage in pll_calc
authorGuillaume Ranquet <granquet@baylibre.com>
Fri, 14 Apr 2023 16:07:46 +0000 (18:07 +0200)
committerVinod Koul <vkoul@kernel.org>
Thu, 4 May 2023 17:42:11 +0000 (23:12 +0530)
The ret variable in mtk_hdmi_pll_calc() was used unitialized as reported
by the kernel test robot.

Fix the issue by removing the variable altogether and testing out the
return value of mtk_hdmi_pll_set_hw()

Fixes: 45810d486bb44 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230413-fixes-for-mt8195-hdmi-phy-v2-1-bbad62e64321@baylibre.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c

index abfc077fb0a8d344844e6c420475b71068384bcc..054b73cb31ee8f789c4acdc91cbc060082ca9bf6 100644 (file)
@@ -213,7 +213,7 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
        u64 tmds_clk, pixel_clk, da_hdmitx21_ref_ck, ns_hdmipll_ck, pcw;
        u8 txpredivs[4] = { 2, 4, 6, 12 };
        u32 fbkdiv_low;
-       int i, ret;
+       int i;
 
        pixel_clk = rate;
        tmds_clk = pixel_clk;
@@ -292,13 +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,
+       return 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;
-
-       return 0;
 }
 
 static int mtk_hdmi_pll_drv_setting(struct clk_hw *hw)