diff mbox series

[U-Boot] pci_ep: Fix Coverity warning

Message ID 20190731080426.13514-1-rfried.dev@gmail.com
State Accepted
Commit 6948f1023f3aa382bb023f115929ab3106edb7ee
Delegated to: Tom Rini
Headers show
Series [U-Boot] pci_ep: Fix Coverity warning | expand

Commit Message

Ramon Fried July 31, 2019, 8:04 a.m. UTC
Fix the following Coverity warning:
CID 244086:  Incorrect expression  (BAD_COMPARE)
Comparing pointer "ep_bar" against NULL using anything besides == or
is likely to be incorrect.

Fixes: 914026d25848 ("drivers: pci_ep: Introduce UCLASS_PCI_EP uclass")

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
---
 drivers/pci_endpoint/pci_ep-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Aug. 8, 2019, 3:16 a.m. UTC | #1
On Wed, Jul 31, 2019 at 11:04:26AM +0300, Ramon Fried wrote:

> Fix the following Coverity warning:
> CID 244086:  Incorrect expression  (BAD_COMPARE)
> Comparing pointer "ep_bar" against NULL using anything besides == or
> is likely to be incorrect.
> 
> Fixes: 914026d25848 ("drivers: pci_ep: Introduce UCLASS_PCI_EP uclass")
> 
> Signed-off-by: Ramon Fried <rfried.dev@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/pci_endpoint/pci_ep-uclass.c b/drivers/pci_endpoint/pci_ep-uclass.c
index 2f9c70398d..9f53a9a9b9 100644
--- a/drivers/pci_endpoint/pci_ep-uclass.c
+++ b/drivers/pci_endpoint/pci_ep-uclass.c
@@ -43,7 +43,7 @@  int pci_ep_set_bar(struct udevice *dev, uint func_no, struct pci_bar *ep_bar)
 	int flags = ep_bar->flags;
 
 	/* Some basic bar validity checks */
-	if (ep_bar->barno > BAR_5 || ep_bar < BAR_0)
+	if (ep_bar->barno > BAR_5 || ep_bar->barno < BAR_0)
 		return -EINVAL;
 
 	if ((ep_bar->barno == BAR_5 &&