sata: ahsata: Fix wrong operand for checking SERR DIAG_X
authorYe Li <ye.li@nxp.com>
Sun, 3 May 2020 14:27:01 +0000 (22:27 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 8 May 2020 22:29:03 +0000 (18:29 -0400)
Fix coverity issue CID 3261683: Wrong operator used
(CONSTANT_EXPRESSION_RESULT) operator_confusion:
({...; __v;}) | 67108864 is always 1/true regardless of the values
of its operand. This occurs as the logical operand of !

When DIAG_X is set, the PHY COMINIT signal is detected, so
should use '&' to check whether it is set.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/ata/dwc_ahsata.c

index a77521479280c1534ca0fc667b05ba69f714c63d..4b37a023380c571d4c1ba28d1d668f6a1905093c 100644 (file)
@@ -223,7 +223,7 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv)
 
                /* Wait for COMINIT bit 26 (DIAG_X) in SERR */
                timeout = 1000;
-               while (!(readl(&port_mmio->serr) | SATA_PORT_SERR_DIAG_X)
+               while (!(readl(&port_mmio->serr) & SATA_PORT_SERR_DIAG_X)
                        && --timeout)
                        ;
                if (timeout <= 0) {