On Mon, Jan 29, 2024 at 05:44:43PM +0100, Philippe Mathieu-Daudé wrote: > When a variable is initialized to &struct->field, use it > in place. Rationale: while this makes the code more concise, > this also helps static analyzers. > > Mechanical change using the following Coccinelle spatch script: > > @@ > type S, F; > identifier s, m, v; > @@ > S *s; > ... > F *v = &s->m; > <+... > - &s->m > + v > ...+> > > Inspired-by: Zhao Liu <zhao1.liu@xxxxxxxxx> > Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> > --- > diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c > index 36e6f93c37..10ddf6bc91 100644 > --- a/hw/xen/xen_pt.c > +++ b/hw/xen/xen_pt.c > @@ -710,7 +710,7 @@ static void xen_pt_destroy(PCIDevice *d) { > uint8_t intx; > int rc; > > - if (machine_irq && !xen_host_pci_device_closed(&s->real_device)) { > + if (machine_irq && !xen_host_pci_device_closed(host_dev)) { > intx = xen_pt_pci_intx(s); > rc = xc_domain_unbind_pt_irq(xen_xc, xen_domid, machine_irq, > PT_IRQ_TYPE_PCI, > @@ -759,8 +759,8 @@ static void xen_pt_destroy(PCIDevice *d) { > memory_listener_unregister(&s->io_listener); > s->listener_set = false; > } > - if (!xen_host_pci_device_closed(&s->real_device)) { > - xen_host_pci_device_put(&s->real_device); > + if (!xen_host_pci_device_closed(host_dev)) { > + xen_host_pci_device_put(host_dev); For the Xen part: Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Thanks, -- Anthony PERARD