* [PATCH v3 0/1] phy: freescale: limit div value in FIELD_PREP()
@ 2025-02-19 10:54 Chongchong Gu
2025-02-19 10:54 ` [PATCH v3 1/1] " Chongchong Gu
0 siblings, 1 reply; 3+ messages in thread
From: Chongchong Gu @ 2025-02-19 10:54 UTC (permalink / raw)
To: vkoul; +Cc: kishon, aford173, linux-phy, linux-kernel, guchongchong
From: guchongchong <guchongchong@xiaomi.com>
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
The error log is following:
'''
In file included from <command-line>:
In function ‘fsl_samsung_hdmi_phy_configure_pll_lock_det’,
inlined from ‘fsl_samsung_hdmi_phy_configure’ at drivers/phy/freescale/phy-fsl-samsung-hdmi.c:469:2:
././include/linux/compiler_types.h:542:38: error: call to ‘__compiletime_assert_538’ declared with attribute error: FIELD_PREP: value too large for the field
...
drivers/phy/freescale/phy-fsl-samsung-hdmi.c:344:9: note: in expansion of macro ‘FIELD_PREP’
344 | writeb(FIELD_PREP(REG12_CK_DIV_MASK, div), phy->regs + PHY_REG(12));
| ^~~~~~~~~~
make[5]: *** [scripts/Makefile.build:207:drivers/phy/freescale/phy-fsl-samsung-hdmi.o] error 1
'''
changes in v3
- Simplified code structure
changes in v2
- modify the commit message
guchongchong (1):
phy: freescale: limit div value in FIELD_PREP()
drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 1/1] phy: freescale: limit div value in FIELD_PREP()
2025-02-19 10:54 [PATCH v3 0/1] phy: freescale: limit div value in FIELD_PREP() Chongchong Gu
@ 2025-02-19 10:54 ` Chongchong Gu
2025-02-19 11:29 ` Adam Ford
0 siblings, 1 reply; 3+ messages in thread
From: Chongchong Gu @ 2025-02-19 10:54 UTC (permalink / raw)
To: vkoul; +Cc: kishon, aford173, linux-phy, linux-kernel, guchongchong
From: guchongchong <guchongchong@xiaomi.com>
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@xiaomi.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/1] phy: freescale: limit div value in FIELD_PREP()
2025-02-19 10:54 ` [PATCH v3 1/1] " Chongchong Gu
@ 2025-02-19 11:29 ` Adam Ford
0 siblings, 0 replies; 3+ messages in thread
From: Adam Ford @ 2025-02-19 11:29 UTC (permalink / raw)
To: Chongchong Gu; +Cc: vkoul, kishon, linux-phy, linux-kernel, guchongchong
On Wed, Feb 19, 2025 at 4:54 AM Chongchong Gu <chongchonggu21@gmail.com> wrote:
>
> From: guchongchong <guchongchong@xiaomi.com>
>
> 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).
>
There has already been a fix applied to linux-next to address this
[1]. Have you tried this to see if it works with your compiler?
adam
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/phy/freescale?h=next-20250219&id=cd57e4327707126dca3f9517b84274c001d4c184
> 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@xiaomi.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-19 11:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-19 10:54 [PATCH v3 0/1] phy: freescale: limit div value in FIELD_PREP() Chongchong Gu
2025-02-19 10:54 ` [PATCH v3 1/1] " Chongchong Gu
2025-02-19 11:29 ` Adam Ford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®