Re: [PATCH v2] pciutils: Display physical slot information in lspci -v

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

 



Hello!

> We've been exposing slot information in /sys/bus/pci/slots for a
> long time now (as long as a hotplug driver or slot detection
> driver like pci_slot is loaded).

This is much better than the previous version, however you are still
leaking memory.

(Also, please follow the indentation style of the original code.)

> +static int
> +sysfs_fill_info(struct pci_dev *d, int flags)
> +{
> +  int ret;
> +  static int firstime;
> +
> +  ret = pci_generic_fill_info(d, flags);
> +  if (!firstime && flags & PCI_FILL_PHYS_SLOT) {
> +    sysfs_fill_slots(d);
> +    firstime = 1;
> +  }
> +
> +  return ret;
> +}

Using a static variable for this is wrong, since it breaks applications
working with multiple pci_access structures.

				Have a nice fortnight
-- 
Martin `MJ' Mares                          <mj@xxxxxx>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"God doesn't play dice."   -- Albert Einstein
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux