On Tue, 18 Apr 2017 19:17:24 -0300 Eduardo Habkost <ehabk...@redhat.com> wrote:
> "phb->bus" is a short expression, there's no need for an extra variable > just to hold its value. > > Generated using the following Coccinelle patch: > > @@ > identifier b; > identifier phb; > typedef PCIBus; > @@ > -PCIBus *b; > ... when != b > -b = phb->bus; > <... > -b > +phb->bus > ...> > > Cc: Richard Henderson <r...@twiddle.net> > Cc: "Michael S. Tsirkin" <m...@redhat.com> > Cc: Marcel Apfelbaum <mar...@redhat.com> > Cc: Alexander Graf <ag...@suse.de> > Cc: Scott Wood <scottw...@freescale.com> > Cc: David Gibson <da...@gibson.dropbear.id.au> > Cc: Cornelia Huck <cornelia.h...@de.ibm.com> > Cc: Christian Borntraeger <borntrae...@de.ibm.com> > Cc: qemu-...@nongnu.org > Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> > --- > hw/alpha/typhoon.c | 10 ++++------ > hw/pci-bridge/pci_expander_bridge.c | 4 +--- > hw/pci-host/piix.c | 26 +++++++++++++------------- > hw/pci-host/ppce500.c | 8 +++----- > hw/ppc/ppc4xx_pci.c | 4 +--- > hw/ppc/spapr_pci.c | 6 ++---- > hw/s390x/s390-pci-bus.c | 6 ++---- > 7 files changed, 26 insertions(+), 38 deletions(-) > > diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c > index 5e174e90f4..c2776ba221 100644 > --- a/hw/s390x/s390-pci-bus.c > +++ b/hw/s390x/s390-pci-bus.c > @@ -553,7 +553,6 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus > *bus, int32_t devfn) > > static int s390_pcihost_init(SysBusDevice *dev) > { > - PCIBus *b; > BusState *bus; > PCIHostState *phb = PCI_HOST_BRIDGE(dev); > S390pciState *s = S390_PCI_HOST_BRIDGE(dev); > @@ -563,10 +562,9 @@ static int s390_pcihost_init(SysBusDevice *dev) > pci_host_bus_init_irqs(phb, NULL, s390_pci_set_irq, s390_pci_map_irq, > NULL, get_system_memory(), get_system_io(), 0, 64, > TYPE_PCI_BUS); > - b = phb->bus; > - pci_setup_iommu(b, s390_pci_dma_iommu, s); > + pci_setup_iommu(phb->bus, s390_pci_dma_iommu, s); > > - bus = BUS(b); > + bus = BUS(phb->bus); This BusState variable is equally unnecessary, as is it just used in the line below. But that is outside the scope of that simple coccinelle patch, so > qbus_set_hotplug_handler(bus, DEVICE(dev), NULL); > > s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL)); Acked-by: Cornelia Huck <cornelia.h...@de.ibm.com> for the s390 part.