Skip to content

Commit

Permalink
PCI: fix pci_setup_device()'s sprinting into a const buffer
Browse files Browse the repository at this point in the history
Make pci_setup_device() write the bus ID directly into the allotted storage,
rather than using pci_name() as the address as that now returns a const
pointer.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
David Howells authored and Jesse Barnes committed Jun 27, 2008
1 parent 9433f6d commit 8b285ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,9 @@ static int pci_setup_device(struct pci_dev * dev)
{
u32 class;

sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
snprintf(dev->dev.bus_id, BUS_ID_SIZE,
"%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));

pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
dev->revision = class & 0xff;
Expand Down

0 comments on commit 8b285ce

Please sign in to comment.