Skip to contentSkip to conversation

phy: freescale: fsl-samsung-hdmi: Fix 64-by-32 division cocci warnings

PATCH Applied Adam Ford 2 participants 2 messages Dec 15, 2024 – Dec 24, 2024 Generic PHY framework

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 phy: freescale: fsl-samsung-hdmi: Fix 64-by-32 division cocci warnings

The Kernel test robot returns the following warning:
do_div() does a 64-by-32 division, please consider using div64_ul instead.

To prevent the 64-by-32 divsion, consolidate both the multiplication and the do_div into one line which explicitly uses u64 sizes.

Fixes 1951dbb41d1d ("phy: freescale: fsl-samsung-hdmi: Support dynamic integer")
drivers/phy/freescale/phy-fsl-samsung-hdmi.c +1 -2
index 2c8038864357..d3ccf547ba1c 100644
@@ -424,8 +424,7 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
 			 * Fvco = (M * f_ref) / P,
 			 * where f_ref is 24MHz.
 			 */
-			tmp = (u64)_m * 24 * MHZ;
-			do_div(tmp, _p);
+			tmp = div64_ul((u64)_m * 24 * MHZ, _p);
 			if (tmp < 750 * MHZ ||
 			    tmp > 3000 * MHZ)
 				continue;
Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Adam Ford

The Kernel test robot returns the following warning:
do_div() does a 64-by-32 division, please consider using div64_ul instead.

To prevent the 64-by-32 divsion, consolidate both the multiplication and the do_div into one line which explicitly uses u64 sizes.

[...]

Applied, thanks!

[1/1] phy: freescale: fsl-samsung-hdmi: Fix 64-by-32 division cocci warnings

      commit: 739214dd1c209e34323814fb815fb17cccb9f95b

Best regards,

Signature · 1 line
~Vinod