Commit c4cdf737 authored by Thorsten Blum's avatar Thorsten Blum Committed by Jakub Kicinski
Browse files

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().

Cc: stable@vger.kernel.org
Fixes: a557a92e ("net: phy: marvell-88q2xxx: add support for temperature sensor")
Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarDimitri Fedrau <dima.fedrau@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251202172743.453055-3-thorsten.blum@linux.dev


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6a107cfe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);