Message ID | 20200503142703.14903-2-peng.fan@nxp.com |
---|---|
State | New |
Headers | show |
Series | [1/4] sata: ahsata: Fix resource leak | expand |
On Sun, 3 May 2020 at 08:04, Peng Fan <peng.fan at nxp.com> wrote: > > From: Ye Li <ye.li at nxp.com> > > 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 at nxp.com> > Signed-off-by: Peng Fan <peng.fan at nxp.com> > --- > drivers/ata/dwc_ahsata.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg at chromium.org>
On Sun, May 03, 2020 at 10:27:01PM +0800, Peng Fan wrote: > From: Ye Li <ye.li at nxp.com> > > 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 at nxp.com> > Signed-off-by: Peng Fan <peng.fan at nxp.com> > Reviewed-by: Simon Glass <sjg at chromium.org> Applied to u-boot/master, thanks!
diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index a775214792..4b37a02338 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -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) {