[PATCH v3 1/1] phy: freescale: limit div value in FIELD_PREP()

From: Chongchong Gu
Date: Wed Feb 19 2025 - 05:54:43 EST


From: guchongchong <guchongchong@xxxxxxxxxx>

In fsl_samsung_hdmi_phy_configure_pll_lock_det, the variable named
div becomes 4 after loop. It must less than 4 in function named
FIELD_PREP(REG12_CK_DIV_MASK, div).

A way to reproduce when run the following shell command
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4

Fixes: <d567679f2b6a> ("phy: freescale: fsl-samsung-hdmi: Clean up")
Signed-off-by: guchongchong <guchongchong@xxxxxxxxxx>
---
drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 45004f598e4d..0ad766359cbe 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -337,7 +337,7 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy,
/* Find int_pllclk speed */
for (div = 0; div < 4; div++) {
int_pllclk = pclk / (1 << div);
- if (int_pllclk < (50 * MHZ))
+ if (int_pllclk < (50 * MHZ) || div == 3)
break;
}

--
2.48.1