linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@lists.01.org, Takashi Iwai <tiwai@suse.de>,
	lkp@intel.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 1517/2389] sound/pci/als4000.c:930 snd_card_als4000_probe() warn: 'pci' not released on lines: 852,872.
Date: Thu, 22 Jul 2021 18:19:19 +0200	[thread overview]
Message-ID: <s5hr1fqjp88.wl-tiwai@suse.de> (raw)
In-Reply-To: <202107221413.qyIXVv60-lkp@intel.com>

On Thu, 22 Jul 2021 11:28:17 +0200,
Dan Carpenter wrote:
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   b1347210b01daa977ea980268927aa99198ceccc
> commit: 0e175f665960c7be30aba47afbee4f2d121ea5fc [1517/2389] ALSA: als4000: Allocate resources with device-managed APIs
> config: x86_64-randconfig-m001-20210722 (attached as .config)
> compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> sound/pci/als4000.c:930 snd_card_als4000_probe() warn: 'pci' not released on lines: 852,872.
> 
> vim +/pci +930 sound/pci/als4000.c
> 
> e23e7a14362072 Bill Pemberton  2012-12-06  809  static int snd_card_als4000_probe(struct pci_dev *pci,
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  810  				  const struct pci_device_id *pci_id)
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  811  {
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  812  	static int dev;
> 17c39d9a59cbf4 Takashi Iwai    2005-11-17  813  	struct snd_card *card;
> 17c39d9a59cbf4 Takashi Iwai    2005-11-17  814  	struct snd_card_als4000 *acard;
> c0874449849175 Andreas Mohr    2008-08-20  815  	unsigned long iobase;
> 17c39d9a59cbf4 Takashi Iwai    2005-11-17  816  	struct snd_sb *chip;
> 17c39d9a59cbf4 Takashi Iwai    2005-11-17  817  	struct snd_opl3 *opl3;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  818  	unsigned short word;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  819  	int err;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  820  
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  821  	if (dev >= SNDRV_CARDS)
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  822  		return -ENODEV;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  823  	if (!enable[dev]) {
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  824  		dev++;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  825  		return -ENOENT;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  826  	}
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  827  
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  828  	/* enable PCI device */
> 0e175f665960c7 Takashi Iwai    2021-07-15  829  	err = pcim_enable_device(pci);
> 61ea06e8a88163 Takashi Iwai    2021-06-08  830  	if (err < 0)
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  831  		return err;
> 61ea06e8a88163 Takashi Iwai    2021-06-08  832  
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  833  	/* check, if we can restrict PCI DMA transfers to 24 bits */
> 669f65eaeb969e Takashi Iwai    2021-01-14  834  	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(24))) {
> d85d878efb3047 Takashi Iwai    2014-02-25  835  		dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n");
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  836  		return -ENXIO;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  837  	}
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  838  
> 61ea06e8a88163 Takashi Iwai    2021-06-08  839  	err = pci_request_regions(pci, "ALS4000");
>                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 0e175f665960c7 Takashi Iwai    2021-07-15  840  	if (err < 0)
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  841  		return err;
> c0874449849175 Andreas Mohr    2008-08-20  842  	iobase = pci_resource_start(pci, 0);
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  843  
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  844  	pci_read_config_word(pci, PCI_COMMAND, &word);
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  845  	pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO);
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  846  	pci_set_master(pci);
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  847  	
> 0e175f665960c7 Takashi Iwai    2021-07-15  848  	err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
> e58de7baf7de11 Takashi Iwai    2008-12-28  849  				sizeof(*acard) /* private_data: acard */,
> e58de7baf7de11 Takashi Iwai    2008-12-28  850  				&card);
> 0e175f665960c7 Takashi Iwai    2021-07-15  851  	if (err < 0)
> e58de7baf7de11 Takashi Iwai    2008-12-28  852  		return err;
>                                                                 ^^^^^^^^^^
> Smatch complains because there is no error handling.  Maybe the other
> error paths use devm_ magic?  Or more likely Smatch just isn't smart
> enough...

I believe those are false-positive.

When the PCI device is already managed via pcim_enable_device(), all
resources (even the ones without pcim_ or devm_) are freed
automagically.


thanks,

Takashi


  reply	other threads:[~2021-07-22 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  9:28 [linux-next:master 1517/2389] sound/pci/als4000.c:930 snd_card_als4000_probe() warn: 'pci' not released on lines: 852,872 Dan Carpenter
2021-07-22 16:19 ` Takashi Iwai [this message]
2021-07-26 12:45   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hr1fqjp88.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).