* [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1()
@ 2025-09-01 13:24 Mark Cave-Ayland
2025-09-01 13:32 ` Peter Maydell
2025-09-01 13:36 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Mark Cave-Ayland @ 2025-09-01 13:24 UTC (permalink / raw)
To: peter.maydell, pbonzini, mst, marcel.apfelbaum, eduardo, imammedo,
qemu-devel
Now that the isapc logic has been split out of pc_piix.c, the PCI Host Bridge
(phb) object is now always set in pc_init1().
Since phb is now guaranteed not to be NULL, Coverity reports that the if()
statement surrounding ioapic_init_gsi() is now unnecessary and can be removed
(CID 1620557).
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Fixes: 99d0630a45 ("hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in pc_init1()")
---
hw/i386/pc_piix.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7e78b6daa6..b6d0cf411d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -284,9 +284,7 @@ static void pc_init1(MachineState *machine, const char *pci_type)
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
}
- if (phb) {
- ioapic_init_gsi(gsi_state, phb);
- }
+ ioapic_init_gsi(gsi_state, phb);
if (tcg_enabled()) {
x86_register_ferr_irq(x86ms->gsi[13]);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1()
2025-09-01 13:24 [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1() Mark Cave-Ayland
@ 2025-09-01 13:32 ` Peter Maydell
2025-09-01 13:36 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2025-09-01 13:32 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: pbonzini, mst, marcel.apfelbaum, eduardo, imammedo, qemu-devel
On Mon, 1 Sept 2025 at 14:26, Mark Cave-Ayland
<mark.caveayland@nutanix.com> wrote:
>
> Now that the isapc logic has been split out of pc_piix.c, the PCI Host Bridge
> (phb) object is now always set in pc_init1().
>
> Since phb is now guaranteed not to be NULL, Coverity reports that the if()
> statement surrounding ioapic_init_gsi() is now unnecessary and can be removed
> (CID 1620557).
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> Fixes: 99d0630a45 ("hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in pc_init1()")
> ---
> hw/i386/pc_piix.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1()
2025-09-01 13:24 [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1() Mark Cave-Ayland
2025-09-01 13:32 ` Peter Maydell
@ 2025-09-01 13:36 ` Philippe Mathieu-Daudé
2025-09-01 14:05 ` Mark Cave-Ayland
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-01 13:36 UTC (permalink / raw)
To: Mark Cave-Ayland, peter.maydell, pbonzini, mst, marcel.apfelbaum,
eduardo, imammedo, qemu-devel
On 1/9/25 15:24, Mark Cave-Ayland wrote:
> Now that the isapc logic has been split out of pc_piix.c, the PCI Host Bridge
> (phb) object is now always set in pc_init1().
>
> Since phb is now guaranteed not to be NULL, Coverity reports that the if()
> statement surrounding ioapic_init_gsi() is now unnecessary and can be removed
> (CID 1620557).
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> Fixes: 99d0630a45 ("hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in pc_init1()")
> ---
> hw/i386/pc_piix.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7e78b6daa6..b6d0cf411d 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -284,9 +284,7 @@ static void pc_init1(MachineState *machine, const char *pci_type)
Maybe also remove the pointless NULL-init?
- Object *phb = NULL;
+ Object *phb;
> pc_i8259_create(isa_bus, gsi_state->i8259_irq);
> }
>
> - if (phb) {
> - ioapic_init_gsi(gsi_state, phb);
> - }
> + ioapic_init_gsi(gsi_state, phb);
>
> if (tcg_enabled()) {
> x86_register_ferr_irq(x86ms->gsi[13]);
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1()
2025-09-01 13:36 ` Philippe Mathieu-Daudé
@ 2025-09-01 14:05 ` Mark Cave-Ayland
0 siblings, 0 replies; 4+ messages in thread
From: Mark Cave-Ayland @ 2025-09-01 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, peter.maydell, pbonzini, mst,
marcel.apfelbaum, eduardo, imammedo, qemu-devel
On 01/09/2025 14:36, Philippe Mathieu-Daudé wrote:
> On 1/9/25 15:24, Mark Cave-Ayland wrote:
>> Now that the isapc logic has been split out of pc_piix.c, the PCI Host
>> Bridge
>> (phb) object is now always set in pc_init1().
>>
>> Since phb is now guaranteed not to be NULL, Coverity reports that the
>> if()
>> statement surrounding ioapic_init_gsi() is now unnecessary and can be
>> removed
>> (CID 1620557).
>>
>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>> Fixes: 99d0630a45 ("hw/i386/pc_piix.c: assume pcmc->pci_enabled is
>> always true in pc_init1()")
>> ---
>> hw/i386/pc_piix.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
>> index 7e78b6daa6..b6d0cf411d 100644
>> --- a/hw/i386/pc_piix.c
>> +++ b/hw/i386/pc_piix.c
>> @@ -284,9 +284,7 @@ static void pc_init1(MachineState *machine, const
>> char *pci_type)
>
> Maybe also remove the pointless NULL-init?
Yeah that's a good point: I've just sent a v2 that also removes this, so
maintainers can choose which version they prefer :)
> - Object *phb = NULL;
> + Object *phb;
>
>> pc_i8259_create(isa_bus, gsi_state->i8259_irq);
>> }
>> - if (phb) {
>> - ioapic_init_gsi(gsi_state, phb);
>> - }
>> + ioapic_init_gsi(gsi_state, phb);
>> if (tcg_enabled()) {
>> x86_register_ferr_irq(x86ms->gsi[13]);
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
ATB,
Mark.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-01 14:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 13:24 [PATCH] hw/i386/pc_piix.c: remove unnecessary if() from pc_init1() Mark Cave-Ayland
2025-09-01 13:32 ` Peter Maydell
2025-09-01 13:36 ` Philippe Mathieu-Daudé
2025-09-01 14:05 ` Mark Cave-Ayland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).