mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Question on __pci_bus_find_cap().
@ 2004-05-07  9:59 Naresh Kumar Inna
  0 siblings, 0 replies; only message in thread
From: Naresh Kumar Inna @ 2004-05-07  9:59 UTC (permalink / raw)
  To: linux-kernel

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.orig  2004-04-04 09:06:54.000000000 +0530
+++ pci.c.mod  2004-05-07 15:06:50.000000000 +0530
@@ -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.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-07  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-07  9:59 Question on __pci_bus_find_cap() Naresh Kumar Inna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®