summaryrefslogtreecommitdiffstats
path: root/hw/spapr_vio.c
diff options
context:
space:
mode:
authorDavid Gibson2011-11-13 18:18:58 +0100
committerAlexander Graf2011-11-18 14:22:45 +0100
commit5435352ce6abfb8a7540ae7d47e981d329120cca (patch)
treea05e6df0b43eeefc37c73e36711ffe77f131568a /hw/spapr_vio.c
parentpseries: Correct RAM size check for SLOF (diff)
downloadqemu-5435352ce6abfb8a7540ae7d47e981d329120cca.tar.gz
qemu-5435352ce6abfb8a7540ae7d47e981d329120cca.tar.xz
qemu-5435352ce6abfb8a7540ae7d47e981d329120cca.zip
pseries: Fix buggy spapr_vio_find_by_reg()
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 <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/spapr_vio.c')
-rw-r--r--hw/spapr_vio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 25cfc9d912..b7b3ddd116 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