Skip to contentSkip to conversation

Question on __pci_bus_find_cap().

PATCH Naresh Kumar Inna 1 participant 1 message May 7, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

The PCI spec 3.0 says that the Capabilities List is terminated with 00H which indicates the last capability in the linked list. But in the code of '__pci_bus_find_cap()', the while loop ( see below) terminates when the value of the position is < 0x40 or a ttl value becomes zero. Shouldnt it simply check for the value 0x0 and terminate? Please let me know if I am missing something. Here is the diff:

pci.c.mod 2004-05-07 15:06:50.000000000 +0530 renamed from pci.c.orig 2004-04-04 09:06:54.000000000 +0530 +1 -2
@@ -71,7 +71,6 @@
 {
        u16 status;
        u8 pos, id;
-       int ttl = 48;
 
        pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status);
        if (!(status & PCI_STATUS_CAP_LIST))
@@ -88,7 +87,7 @@
        default:
                return 0;
        }
-       while (ttl-- && pos >= 0x40) {
+       while (pos != 0x0) {
                pos &= ~3;
                pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_ID,
&id);
                if (id == 0xff)

Regards,
Naresh Kumar,
HP-ISO,
Bangalore.