]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: phy: marvell-88q2xxx: Fix clamped value in mv88q2xxx_hwmon_write
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 2 Dec 2025 17:27:44 +0000 (18:27 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 5 Dec 2025 01:49:31 +0000 (17:49 -0800)
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: Dimitri Fedrau <dima.fedrau@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251202172743.453055-3-thorsten.blum@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/marvell-88q2xxx.c

index f3d83b04c9535c78091a2491d3d551d4d340d130..201dee1a16985efe7f2cd8c5b105d8cee0a3c020 100644 (file)
@@ -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);