From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: sound/pci/ac97/ac97_pcm.c:630 snd_ac97_pcm_open() warn: inconsistent returns '&pcm->bus->bus_lock'.
Date: Fri, 12 Dec 2025 20:45:14 +0800 [thread overview]
Message-ID: <202512122048.tgeB9HR0-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Takashi Iwai <tiwai@suse.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 187d0801404f415f22c0b31531982c7ea97fa341
commit: fcee249f98d0b84d5d0222b47d30c93bbca08e17 ALSA: ac97: Use guard() for spin locks
date: 3 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 3 months ago
config: i386-randconfig-141-20251212 (https://download.01.org/0day-ci/archive/20251212/202512122048.tgeB9HR0-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202512122048.tgeB9HR0-lkp@intel.com/
smatch warnings:
sound/pci/ac97/ac97_pcm.c:630 snd_ac97_pcm_open() warn: inconsistent returns '&pcm->bus->bus_lock'.
sound/pci/ac97/ac97_pcm.c:630 snd_ac97_pcm_open() warn: inconsistent returns 'irq'.
vim +630 sound/pci/ac97/ac97_pcm.c
7b09679c431ba91 Takashi Iwai 2006-04-28 542
^1da177e4c3f415 Linus Torvalds 2005-04-16 543 /**
^1da177e4c3f415 Linus Torvalds 2005-04-16 544 * snd_ac97_pcm_open - opens the given AC97 pcm
^1da177e4c3f415 Linus Torvalds 2005-04-16 545 * @pcm: the ac97 pcm instance
^1da177e4c3f415 Linus Torvalds 2005-04-16 546 * @rate: rate in Hz, if codec does not support VRA, this value must be 48000Hz
^1da177e4c3f415 Linus Torvalds 2005-04-16 547 * @cfg: output stream characteristics
^1da177e4c3f415 Linus Torvalds 2005-04-16 548 * @slots: a subset of allocated slots (snd_ac97_pcm_assign) for this pcm
^1da177e4c3f415 Linus Torvalds 2005-04-16 549 *
^1da177e4c3f415 Linus Torvalds 2005-04-16 550 * It locks the specified slots and sets the given rate to AC97 registers.
eb7c06e8e9c93b4 Yacine Belkadi 2013-03-11 551 *
eb7c06e8e9c93b4 Yacine Belkadi 2013-03-11 552 * Return: Zero if successful, or a negative error code on failure.
^1da177e4c3f415 Linus Torvalds 2005-04-16 553 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 554 int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
^1da177e4c3f415 Linus Torvalds 2005-04-16 555 enum ac97_pcm_cfg cfg, unsigned short slots)
^1da177e4c3f415 Linus Torvalds 2005-04-16 556 {
ee42381e71c5632 Takashi Iwai 2005-11-17 557 struct snd_ac97_bus *bus;
^1da177e4c3f415 Linus Torvalds 2005-04-16 558 int i, cidx, r, ok_flag;
^1da177e4c3f415 Linus Torvalds 2005-04-16 559 unsigned int reg_ok[4] = {0,0,0,0};
^1da177e4c3f415 Linus Torvalds 2005-04-16 560 unsigned char reg;
^1da177e4c3f415 Linus Torvalds 2005-04-16 561 int err = 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 562
^1da177e4c3f415 Linus Torvalds 2005-04-16 563 r = rate > 48000;
^1da177e4c3f415 Linus Torvalds 2005-04-16 564 bus = pcm->bus;
^1da177e4c3f415 Linus Torvalds 2005-04-16 565 if (cfg == AC97_PCM_CFG_SPDIF) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 566 for (cidx = 0; cidx < 4; cidx++)
^1da177e4c3f415 Linus Torvalds 2005-04-16 567 if (bus->codec[cidx] && (bus->codec[cidx]->ext_id & AC97_EI_SPDIF)) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 568 err = set_spdif_rate(bus->codec[cidx], rate);
^1da177e4c3f415 Linus Torvalds 2005-04-16 569 if (err < 0)
^1da177e4c3f415 Linus Torvalds 2005-04-16 570 return err;
^1da177e4c3f415 Linus Torvalds 2005-04-16 571 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 572 }
fcee249f98d0b84 Takashi Iwai 2025-08-29 573 scoped_guard(spinlock_irq, &pcm->bus->bus_lock) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 574 for (i = 3; i < 12; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 575 if (!(slots & (1 << i)))
^1da177e4c3f415 Linus Torvalds 2005-04-16 576 continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16 577 ok_flag = 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 578 for (cidx = 0; cidx < 4; cidx++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 579 if (bus->used_slots[pcm->stream][cidx] & (1 << i)) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 580 err = -EBUSY;
^1da177e4c3f415 Linus Torvalds 2005-04-16 581 goto error;
^1da177e4c3f415 Linus Torvalds 2005-04-16 582 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 583 if (pcm->r[r].rslots[cidx] & (1 << i)) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 584 bus->used_slots[pcm->stream][cidx] |= (1 << i);
^1da177e4c3f415 Linus Torvalds 2005-04-16 585 ok_flag++;
^1da177e4c3f415 Linus Torvalds 2005-04-16 586 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 587 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 588 if (!ok_flag) {
38c16e34fe2f72c Takashi Iwai 2014-02-25 589 dev_err(bus->card->dev,
38c16e34fe2f72c Takashi Iwai 2014-02-25 590 "cannot find configuration for AC97 slot %i\n",
38c16e34fe2f72c Takashi Iwai 2014-02-25 591 i);
^1da177e4c3f415 Linus Torvalds 2005-04-16 592 err = -EAGAIN;
^1da177e4c3f415 Linus Torvalds 2005-04-16 593 goto error;
^1da177e4c3f415 Linus Torvalds 2005-04-16 594 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 595 }
6dbe662874ba085 Takashi Iwai 2006-06-27 596 pcm->cur_dbl = r;
fcee249f98d0b84 Takashi Iwai 2025-08-29 597 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 598 for (i = 3; i < 12; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 599 if (!(slots & (1 << i)))
^1da177e4c3f415 Linus Torvalds 2005-04-16 600 continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16 601 for (cidx = 0; cidx < 4; cidx++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 602 if (pcm->r[r].rslots[cidx] & (1 << i)) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 603 reg = get_slot_reg(pcm, cidx, i, r);
^1da177e4c3f415 Linus Torvalds 2005-04-16 604 if (reg == 0xff) {
38c16e34fe2f72c Takashi Iwai 2014-02-25 605 dev_err(bus->card->dev,
38c16e34fe2f72c Takashi Iwai 2014-02-25 606 "invalid AC97 slot %i?\n", i);
^1da177e4c3f415 Linus Torvalds 2005-04-16 607 continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16 608 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 609 if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
^1da177e4c3f415 Linus Torvalds 2005-04-16 610 continue;
38c16e34fe2f72c Takashi Iwai 2014-02-25 611 dev_dbg(bus->card->dev,
38c16e34fe2f72c Takashi Iwai 2014-02-25 612 "setting ac97 reg 0x%x to rate %d\n",
38c16e34fe2f72c Takashi Iwai 2014-02-25 613 reg, rate);
^1da177e4c3f415 Linus Torvalds 2005-04-16 614 err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
^1da177e4c3f415 Linus Torvalds 2005-04-16 615 if (err < 0)
38c16e34fe2f72c Takashi Iwai 2014-02-25 616 dev_err(bus->card->dev,
38c16e34fe2f72c Takashi Iwai 2014-02-25 617 "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n",
38c16e34fe2f72c Takashi Iwai 2014-02-25 618 cidx, reg, rate, err);
^1da177e4c3f415 Linus Torvalds 2005-04-16 619 else
^1da177e4c3f415 Linus Torvalds 2005-04-16 620 reg_ok[cidx] |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
^1da177e4c3f415 Linus Torvalds 2005-04-16 621 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 622 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 623 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 624 pcm->aslots = slots;
^1da177e4c3f415 Linus Torvalds 2005-04-16 625 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 626
^1da177e4c3f415 Linus Torvalds 2005-04-16 627 error:
^1da177e4c3f415 Linus Torvalds 2005-04-16 628 pcm->aslots = slots;
^1da177e4c3f415 Linus Torvalds 2005-04-16 629 snd_ac97_pcm_close(pcm);
^1da177e4c3f415 Linus Torvalds 2005-04-16 @630 return err;
^1da177e4c3f415 Linus Torvalds 2005-04-16 631 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 632
:::::: The code at line 630 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2025-12-12 12:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 12:45 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-03-24 8:22 sound/pci/ac97/ac97_pcm.c:630 snd_ac97_pcm_open() warn: inconsistent returns '&pcm->bus->bus_lock' kernel test robot
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=202512122048.tgeB9HR0-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.