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 <[email protected]>
Signed-off-by: David Gibson <[email protected]>
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);
ICSState *ics = spapr->ics;
int i, first = -1;
- if (!ics) {
- return -1;
- }
+ assert(ics);
/*
* MSIMesage::data is used for storing VIRQ so