| From b5cbd6e6c421317fd8fef91212f897293d906477 Mon Sep 17 00:00:00 2001 |
| From: Vivien Didelot <vivien.didelot@gmail.com> |
| Date: Fri, 9 Aug 2019 18:47:58 -0400 |
| Subject: [PATCH] net: dsa: mv88e6xxx: fix SMI bit checking |
| |
| commit 1c6463b6fc36f2261df1a68ee13a5ebd980914b1 upstream. |
| |
| The current mv88e6xxx_smi_direct_wait function is only used to check |
| the 16th bit of the (16-bit) SMI Command register. But the bit shift |
| operation is not enough if we eventually use this function to check |
| other bits, thus replace it with a mask. |
| |
| Fixes: e7ba0fad9c53 ("net: dsa: mv88e6xxx: refine SMI support") |
| Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/dsa/mv88e6xxx/smi.c b/drivers/net/dsa/mv88e6xxx/smi.c |
| index 92e9324f1fb9..919e0d6e0134 100644 |
| --- a/drivers/net/dsa/mv88e6xxx/smi.c |
| +++ b/drivers/net/dsa/mv88e6xxx/smi.c |
| @@ -60,7 +60,7 @@ static int mv88e6xxx_smi_direct_wait(struct mv88e6xxx_chip *chip, |
| if (err) |
| return err; |
| |
| - if (!!(data >> bit) == !!val) |
| + if (!!(data & BIT(bit)) == !!val) |
| return 0; |
| } |
| |
| -- |
| 2.27.0 |
| |