[PATCH] Fix incorrect pci_for_each_dev usage

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.

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2005-01-19Z18:01:10