net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
Subsystems (4)
PATCH 1/1 net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
The local variable 'val' was never clamped to -75000 or 180000 because the return value of clamp_val() was not used. Fix this by assigning the clamped value back to 'val', and use clamp() instead of clamp_val().
--- drivers/net/phy/marvell-88q2xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/marvell-88q2xxx.c +1 -1
@@ -698,7 +698,7 @@ static int mv88q2xxx_hwmon_write(struct device *dev,switch (attr) {case hwmon_temp_max: -clamp_val (val,-75000 ,180000 ); + val =clamp (val,-75000 ,180000 ); val = (val /1000 ) +75 ; val =FIELD_PREP (MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK , val);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Hi Thorsten,
thanks for the fix.
Am Tue, Dec 02, 2025 at 06:27:44PM +0100 schrieb Thorsten Blum:
Quoted 28 lines
The local variable 'val' was never clamped to -75000 or 180000 because the return value of
clamp_val()was not used. Fix this by assigning the clamped value back to 'val', and useclamp()instead ofclamp_val().Fixes a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")Signed-off-by Thorsten Blum <[email protected]>--- drivers/net/phy/marvell-88q2xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/phy/marvell-88q2xxx.c +1
-1@@ -698,7 +698,7 @@ static int mv88q2xxx_hwmon_write(struct device *dev,switch (attr) {case hwmon_temp_max: -clamp_val (val,-75000 ,180000 ); + val =clamp (val,-75000 ,180000 ); val = (val /1000 ) +75 ; val =FIELD_PREP (MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK , val);Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Quoted 7 lines · Thorsten Blum
The local variable 'val' was never clamped to -75000 or 180000 because the return value of
clamp_val()was not used. Fix this by assigning the clamped value back to 'val', and useclamp()instead ofclamp_val().Fixes a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")Signed-off-by Thorsten Blum <[email protected]>
Andrew
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 2 Dec 2025 18:27:44 +0100 you wrote:
The local variable 'val' was never clamped to -75000 or 180000 because the return value of
clamp_val()was not used. Fix this by assigning the clamped value back to 'val', and useclamp()instead ofclamp_val().Fixes a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")Signed-off-by Thorsten Blum <[email protected]>[...]
Here is the summary with links:
- [net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
https://git.kernel.org/netdev/net/c/c4cdf7376271
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html