* [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
@ 2025-12-02 17:27 Thorsten Blum
2025-12-02 18:18 ` Dimitri Fedrau
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2025-12-02 17:27 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Guenter Roeck,
Dimitri Fedrau
Cc: Thorsten Blum, stable, netdev, linux-kernel
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().
Cc: stable@vger.kernel.org
Fixes: a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/net/phy/marvell-88q2xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
index f3d83b04c953..201dee1a1698 100644
--- a/drivers/net/phy/marvell-88q2xxx.c
+++ b/drivers/net/phy/marvell-88q2xxx.c
@@ -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);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
2025-12-02 17:27 [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write Thorsten Blum
@ 2025-12-02 18:18 ` Dimitri Fedrau
2025-12-02 18:35 ` Andrew Lunn
2025-12-05 3:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Dimitri Fedrau @ 2025-12-02 18:18 UTC (permalink / raw)
To: Thorsten Blum
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Guenter Roeck, stable,
netdev, linux-kernel
Hi Thorsten,
thanks for the fix.
Reviewed-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Am Tue, Dec 02, 2025 at 06:27:44PM +0100 schrieb 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 use clamp() instead of clamp_val().
>
> Cc: stable@vger.kernel.org
> Fixes: a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/net/phy/marvell-88q2xxx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
> index f3d83b04c953..201dee1a1698 100644
> --- a/drivers/net/phy/marvell-88q2xxx.c
> +++ b/drivers/net/phy/marvell-88q2xxx.c
> @@ -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);
> --
> Thorsten Blum <thorsten.blum@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
2025-12-02 17:27 [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write Thorsten Blum
2025-12-02 18:18 ` Dimitri Fedrau
@ 2025-12-02 18:35 ` Andrew Lunn
2025-12-05 3:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2025-12-02 18:35 UTC (permalink / raw)
To: Thorsten Blum
Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Guenter Roeck, Dimitri Fedrau,
stable, netdev, linux-kernel
On Tue, Dec 02, 2025 at 06:27:44PM +0100, Thorsten Blum 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 use clamp() instead of clamp_val().
>
> Cc: stable@vger.kernel.org
> Fixes: a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
2025-12-02 17:27 [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write Thorsten Blum
2025-12-02 18:18 ` Dimitri Fedrau
2025-12-02 18:35 ` Andrew Lunn
@ 2025-12-05 3:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-05 3:20 UTC (permalink / raw)
To: Thorsten Blum
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, linux,
dima.fedrau, stable, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
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 use clamp() instead of clamp_val().
>
> Cc: stable@vger.kernel.org
> Fixes: a557a92e6881 ("net: phy: marvell-88q2xxx: add support for temperature sensor")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-05 3:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 17:27 [PATCH net] net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write Thorsten Blum
2025-12-02 18:18 ` Dimitri Fedrau
2025-12-02 18:35 ` Andrew Lunn
2025-12-05 3:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).