[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 2/5] pseries: Fix buggy spapr_vio_find_by_reg()
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 2/5] pseries: Fix buggy spapr_vio_find_by_reg() |
Date: |
Mon, 14 Nov 2011 14:18:58 +1100 |
The spapr_vio_find_by_reg() function in hw/spapr_vio.c is supposed to find
the device structure for a PAPR virtual IO device with the given reg value,
and return NULL if none exists.
It does the first ok, but if no device with that reg exists, it just
returns the last device traversed in the list. This patch fixes it.
Signed-off-by: David Gibson <address@hidden>
---
hw/spapr_vio.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 25cfc9d..b7b3ddd 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -66,11 +66,11 @@ VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus,
uint32_t reg)
QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) {
dev = (VIOsPAPRDevice *)qdev;
if (dev->reg == reg) {
- break;
+ return dev;
}
}
- return dev;
+ return NULL;
}
#ifdef CONFIG_FDT
--
1.7.7.1
- [Qemu-ppc] [0/5] Assorted small pseries bug fixes, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 1/5] pseries: Correct RAM size check for SLOF, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 4/5] pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 5/5] pseries: Allow kernel's early debug output to work, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 2/5] pseries: Fix buggy spapr_vio_find_by_reg(),
David Gibson <=
- [Qemu-ppc] [PATCH 3/5] pseries: Check we have a chardev in spapr_vty_init(), David Gibson, 2011/11/13
- Re: [Qemu-ppc] [0/5] Assorted small pseries bug fixes, Alexander Graf, 2011/11/15
- Re: [Qemu-ppc] [0/5] Assorted small pseries bug fixes, Alexander Graf, 2011/11/18