Re: [PATCH] Fix incorrect pci_for_each_dev usage

On Wednesday 19 January 2005 01:01 pm, Ian Abbott wrote:
> Hi,
>
> There are a few Comedi drivers (including a couple I've written) that
> look for PCI devices something like this:
>
>  pci_for_each_dev(pci_dev) {
>   /* check for match here, 'break' if found a match */
>   if (found_a_matching_device)
>    break;
>  }
>  if (!pci_dev) {
>   printk("foo not found!\n");
>   return -EIO;
>  }
>
>  ret = pci_enable_device(pci_dev);
>
> The problem is that the pci_dev pointer is *not* NULL at the end of the
> loop when no matching device is found, at least for 2.4 kernels.
>
> The attached patch fixes the problem in the amplc_pc236, amplc_pc263,
> amplc_pci230, cb_pcidda, das08 and rtd520 drivers.  I've used 'goto'
> statements only in those drivers that already use it.

Thanks for the bug report/patch.  I decided to just remove pci_for_each_dev 
entirely.

-- 
Frank

Received on 2005-01-22Z14:23:54