[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 28/49] spapr: drop useless sanity check in spapr_irq_al
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 28/49] spapr: drop useless sanity check in spapr_irq_alloc*() |
Date: |
Fri, 27 Apr 2018 19:21:05 +1000 |
From: Greg Kurz <address@hidden>
Both spapr_irq_alloc() and spapr_irq_alloc_block() have an errp
parameter, but they don't use it if XICS hasn't been initialized
yet.
This is doubly wrong:
- all callers do pass a non-null Error **, ie, they expect an error
to be propagated in case of failure
- XICS obviously needs to be initialized before anything starts allocating
IRQs
So this patch turns the check into an assert.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b92dad2273..5a1c1e25e1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3719,9 +3719,8 @@ int spapr_irq_alloc(sPAPRMachineState *spapr, int
irq_hint, bool lsi,
ICSState *ics = spapr->ics;
int irq;
- if (!ics) {
- return -1;
- }
+ assert(ics);
+
if (irq_hint) {
if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) {
error_setg(errp, "can't allocate IRQ %d: already in use",
irq_hint);
@@ -3753,9 +3752,7 @@ int spapr_irq_alloc_block(sPAPRMachineState *spapr, int
num, bool lsi,
ICSState *ics = spapr->ics;
int i, first = -1;
- if (!ics) {
- return -1;
- }
+ assert(ics);
/*
* MSIMesage::data is used for storing VIRQ so
--
2.14.3
- [Qemu-ppc] [PULL 16/49] uninorth: fix PCI and AGP bus mixup, (continued)
- [Qemu-ppc] [PULL 16/49] uninorth: fix PCI and AGP bus mixup, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 13/49] uninorth: move PCI mmio memory region initialisation into init function, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 06/49] uninorth: alter pci_pmac_init() and pci_pmac_u3_init() to return uninorth device, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 05/49] uninorth: move uninorth definitions into uninorth.h, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 19/49] uninorth: remove obsolete pci_pmac_u3_init() function, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 17/49] uninorth: enable internal PCI host bridge, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 24/49] target/ppc: Fix reserved bit mask of dstst instruction, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 30/49] spapr: drop useless dynamic sysbus device sanity check, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 15/49] uninorth: move PCI host bridge bus initialisation into device realize, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 20/49] uninorth: use object link to pass OpenPIC object to uninorth, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 28/49] spapr: drop useless sanity check in spapr_irq_alloc*(),
David Gibson <=
- [Qemu-ppc] [PULL 22/49] uninorth: rename UNINState to UNINHostState, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 18/49] uninorth: remove obsolete pci_pmac_init() function, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 39/49] target/ppc: Move 1T segment and AMR options to PPCHash64Options, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 37/49] target/ppc: Split page size information into a separate allocation, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 38/49] target/ppc: Make hash64_opts field mandatory for 64-bit hash MMUs, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 40/49] target/ppc: Fold ci_large_pages flag into PPCHash64Options, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 34/49] target/ppc: Avoid taking "env" parameter to mmu-hash64 functions, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 21/49] uninorth: move PCI IO (ISA) memory region into the uninorth device, David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 33/49] target/ppc: Pass cpu instead of env to ppc_create_page_sizes_prop(), David Gibson, 2018/04/27
- [Qemu-ppc] [PULL 31/49] target/ppc: Standardize instance_init and realize function names, David Gibson, 2018/04/27