]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: mv88e6xxx: Fix error when setting port policy on mv88e6393x
authorPeter Rashleigh <peter@rashleigh.ca>
Wed, 16 Oct 2024 04:08:22 +0000 (21:08 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Nov 2024 00:52:36 +0000 (01:52 +0100)
[ Upstream commit 12bc14949c4a7272b509af0f1022a0deeb215fd8 ]

mv88e6393x_port_set_policy doesn't correctly shift the ptr value when
converting the policy format between the old and new styles, so the
target register ends up with the ptr being written over the data bits.

Shift the pointer to align with the format expected by
mv88e6393x_port_policy_write().

Fixes: 6584b26020fc ("net: dsa: mv88e6xxx: implement .port_set_policy for Amethyst")
Signed-off-by: Peter Rashleigh <peter@rashleigh.ca>
Reviewed-by: Simon Horman <horms@kernel.org>
Message-ID: <20241016040822.3917-1-peter@rashleigh.ca>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/mv88e6xxx/port.c

index ab41619a809b3e98c3da9a53ec455c42a79a7293..c94f2de6401cd81bdf83a9639fe423654efbb440 100644 (file)
@@ -1699,6 +1699,7 @@ int mv88e6393x_port_set_policy(struct mv88e6xxx_chip *chip, int port,
        ptr = shift / 8;
        shift %= 8;
        mask >>= ptr * 8;
+       ptr <<= 8;
 
        err = mv88e6393x_port_policy_read(chip, port, ptr, &reg);
        if (err)