Re: [PATCH kvm-unit-tests v2 08/17] pci: provide pci_scan_bars()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 14, 2016 at 10:18:34PM +0100, Andrew Jones wrote:

[...]

> > diff --git a/lib/pci.c b/lib/pci.c
> > index 0593699..2a58b30 100644
> > --- a/lib/pci.c
> > +++ b/lib/pci.c
> > @@ -230,11 +230,15 @@ void pci_print(void)
> > 
> >  void pci_scan_bars(struct pci_dev *dev)
> >  {
> > -       int i = 0;
> > +       int i;
> > +
> > +       memset(&dev->bar[0], 0, sizeof(dev->bar));
> 
> I'm not sure what this memset is for. Anyway, if you need to zero a
> bar, why not just 
> 
>  bar = (phys_addr_t)0;

The memset is to zero all bars before hand. But I think bar =
(phys_addr_t)0 works enough here:

    void pci_scan_bars(struct pci_dev *dev)
    {
        int i;

        for (i = 0; i < PCI_BAR_NUM; i++) {
            if (!pci_bar_is_valid(dev, i))
                continue;
            dev->bar[i] = pci_bar_get_addr(dev, i);
            if (pci_bar_is64(dev, i)) {
                i++;
                dev->bar[i] = (phys_addr_t)0;
            }
        }
    }

Thanks,

-- peterx
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux