Initialise IRQ pointers as Zero
cover Initialise IRQ pointers as Zero
Hi,
I'm working on some QOM stuff that requires output IRQ pointers to be initialised to zero. I have a catch-all workaround to the problem in the series proper, but this is the startings of a more complete solution.
Sending to trivial, as I think the change is an improvement independently, just due to the fact its easier to debug with NULL pointers rather than undefined pointer values.
Regards,
Peter
Peter Crosthwaite (3):
ssi: xilinx_spi: Initialise CS GPIOs as NULL
ppc: convert g_new(qemu_irq usages to g_new0
intc: i8259: Convert Array allocation to g_new0
hw/intc/i8259.c | 2 +- hw/intc/openpic.c | 2 +- hw/ppc/e500.c | 2 +- hw/ppc/mac_newworld.c | 2 +- hw/ssi/xilinx_spi.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.0.1.1.gfbfc394
PATCH 1/3 ssi: xilinx_spi: Initialise CS GPIOs as NULL
To properly indicate they are unconnected.
---
hw/ssi/xilinx_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/xilinx_spi.c +1 -1
@@ -329,7 +329,7 @@ static int xilinx_spi_init(SysBusDevice *sbd) s->spi =ssi_create_bus (dev,"spi" );sysbus_init_irq (sbd, &s->irq); - s->cs_lines =g_new (qemu_irq, s->num_cs); + s->cs_lines =g_new0 (qemu_irq, s->num_cs);ssi_auto_connect_slaves (dev, s->cs_lines, s->spi);for (i =0 ; i < s->num_cs; ++i) {sysbus_init_irq (sbd, &s->cs_lines[i]);
Signature · 1 line
2.0.1.1.gfbfc394
PATCH 2/3 ppc: convert g_new(qemu_irq usages to g_new0
In reply to Peter CrosthwaiteTo indicate the IRQs are initially disconnected.
---
hw/intc/openpic.c | 2 +- hw/ppc/e500.c | 2 +- hw/ppc/mac_newworld.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/intc/openpic.c +1 -1
@@ -1627,7 +1627,7 @@ static void openpic_realize(DeviceState *dev, Error **errp) }for (i =0 ; i < opp->nb_cpus; i++) { - opp->dst[i].irqs =g_new (qemu_irq,OPENPIC_OUTPUT_NB ); + opp->dst[i].irqs =g_new0 (qemu_irq,OPENPIC_OUTPUT_NB );for (j =0 ; j <OPENPIC_OUTPUT_NB ; j++) {sysbus_init_irq (d, &opp->dst[i].irqs[j]); }
hw/ppc/e500.c +1 -1
@@ -583,7 +583,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,SysBusDevice *s;int i; - mpic =g_new (qemu_irq,256 ); + mpic =g_new0 (qemu_irq,256 );if (kvm_enabled ()) {QemuOpts *machine_opts =qemu_get_machine_opts ();
hw/ppc/mac_newworld.c +1 -1
@@ -346,7 +346,7 @@ static void ppc_core99_init(MachineState *machine) } } - pic =g_new (qemu_irq,64 ); + pic =g_new0 (qemu_irq,64 ); dev =qdev_create (NULL ,TYPE_OPENPIC );qdev_prop_set_uint32 (dev,"model" ,OPENPIC_MODEL_RAVEN );
Signature · 1 line
2.0.1.1.gfbfc394
PATCH 3/3 intc: i8259: Convert Array allocation to g_new0
In reply to Peter CrosthwaiteTo be more array friendly and to indicate the IRQs are initially disconnected.
---
hw/intc/i8259.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/i8259.c +1 -1
@@ -472,7 +472,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)ISADevice *isadev;int i; - irq_set =g_malloc (ISA_NUM_IRQS *sizeof (qemu_irq)); + irq_set =g_new0 (qemu_irq,ISA_NUM_IRQS ); isadev =i8259_init_chip (TYPE_I8259 , bus, true); dev =DEVICE (isadev);
Signature · 1 line
2.0.1.1.gfbfc394
Michael Tokarev
AppliedQuoted 10 lines · Peter Crosthwaite
Hi,
I'm working on some QOM stuff that requires output IRQ pointers to be initialised to zero. I have a catch-all workaround to the problem in the series proper, but this is the startings of a more complete solution.
Sending to trivial, as I think the change is an improvement independently, just due to the fact its easier to debug with NULL pointers rather than undefined pointer values.
Applied all 3 to -trivial, thank you!