Re: [PATCH 1/14 v2] drivers/isdn/hisax/telespci.c: fix warning

Julia Lawall <[email protected]> Sun, 27 Jul 2008 18:00:20 +0200 (CEST)
Newsgroups gmane.linux.isdn,gmane.linux.kernel.janitors
Message-ID <[email protected]>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---511516320-1441090628-1217174420=:1938
Content-Type: TEXT/PLAIN; charset=iso-8859-1
Content-Transfer-Encoding: 8BIT

Some points that I did not pick up on the first time:

1. You have changed the semantics by putting NULL as the last argument of 
pci_get_device.  The last argument of pci_find_device is the one from 
which to start searching for the result.  With NULL as the last argument, 
it starts the search from the beginning of the list.

2. By immediately dropping the reference count, you have at best preserved 
the behavior of pci_find_device, in which the object is not protected from 
being freed, and at worst caused the object to be freed immediately, if no 
one else has increased its reference count.

julia


On Sun, 27 Jul 2008, Michael Borisov wrote:

> Probably now it is correct ? 
> This patch fixes the following compile warning:
> 
> drivers/isdn/hisax/telespci.c: In function ÿÿsetup_telespciÿÿ:
> drivers/isdn/hisax/telespci.c:303: warning: ÿÿpci_find_deviceÿÿ is
> deprecated (declared at include/linux/pci.h:535)
> 
> Signed-off-by: Michael Borisov <[email protected]>
> ---
> diff --git a/drivers/isdn/hisax/telespci.c
> b/drivers/isdn/hisax/telespci.c
> index 28b08de..1142f35 100644
> --- a/drivers/isdn/hisax/telespci.c
> +++ b/drivers/isdn/hisax/telespci.c
> @@ -300,7 +300,9 @@ setup_telespci(struct IsdnCard *card)
>  	if (cs->typ != ISDN_CTYPE_TELESPCI)
>  		return (0);
>  
> -	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN,
> PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
> +	dev_tel = pci_get_device (PCI_VENDOR_ID_ZORAN,
> PCI_DEVICE_ID_ZORAN_36120, NULL);
> +	if (dev_tel) {
> +		pci_dev_put(dev_tel);
>  		if (pci_enable_device(dev_tel))
>  			return(0);
>  		cs->irq = dev_tel->irq;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
---511516320-1441090628-1217174420=:1938--
--
To unsubscribe from this list: send the line "unsubscribe linux-isdn" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html