[libvirt] [PATCH] pci.c: correct erroneous expression

Jim Meyering jim at meyering.net
Tue Jan 26 19:41:39 UTC 2010


An expression like this, can never be true, since the RHS is nonzero:

  ... !pciRead16(dev, PCI_CLASS_DEVICE) == PCI_CLASS_BRIDGE_PCI)

This appears to be what was intended:

  pciRead16(dev, PCI_CLASS_DEVICE) != PCI_CLASS_BRIDGE_PCI)


>From a86de65c1da4f2cc9408465f6bc9ded481def47d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 26 Jan 2010 20:36:58 +0100
Subject: [PATCH] pci.c: correct erroneous expression

* src/util/pci.c (pciDeviceDownstreamLacksACS): Fix a typo
that rendered a subexpression always false.
---
 src/util/pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index 09535bd..0274806 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1266,7 +1266,7 @@ pciDeviceDownstreamLacksACS(virConnectPtr conn,
         return -1;

     pos = dev->pcie_cap_pos;
-    if (!pos || !pciRead16(dev, PCI_CLASS_DEVICE) == PCI_CLASS_BRIDGE_PCI)
+    if (!pos || pciRead16(dev, PCI_CLASS_DEVICE) != PCI_CLASS_BRIDGE_PCI)
         return 0;

     flags = pciRead16(dev, pos + PCI_EXP_FLAGS);
--
1.7.0.rc0.140.gfbe7




More information about the libvir-list mailing list