sound/pci/au88x0/au88x0_core.c:2029 vortex_adb_checkinout() warn: signedness bug returning '(-22)'

kernel test robot
2020-10-09T12:01:09Z

[-- Attachment #1: Type: text/plain, Size: 5045 bytes --]

Hi Luc,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c85fb28b6f999db9928b841f63f1beeb3074eeca
commit: 80591e61a0f7e88deaada69844e4a31280c4a38f kbuild: tell sparse about the $ARCH
config: powerpc64-randconfig-m031-20201008 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.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>

New smatch warnings:
sound/pci/au88x0/au88x0_core.c:2029 vortex_adb_checkinout() warn: signedness bug returning '(-22)'
sound/pci/rme9652/hdsp.c:4085 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'

Old smatch warnings:
sound/pci/au88x0/au88x0_core.c:2046 vortex_adb_checkinout() warn: signedness bug returning '(-12)'
sound/pci/rme9652/hdsp.c:3338 snd_hdsp_proc_read() warn: argument 5 to %lx specifier is cast from pointer
sound/pci/rme9652/hdsp.c:5305 snd_hdsp_create() warn: 'hdsp->iobase' not released on lines: 5237.
sound/pci/rme9652/hdsp.c:5305 snd_hdsp_create() warn: 'pci' not released on lines: 5237.

vim +2029 sound/pci/au88x0/au88x0_core.c

^1da177e4c3f415 Linus Torvalds 2005-04-16 2001 static char
^^^^
Is char unsigned on PowerPC? I thought that was only on s390.

^1da177e4c3f415 Linus Torvalds 2005-04-16 2002 vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype)
^1da177e4c3f415 Linus Torvalds 2005-04-16 2003 {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2004 int i, qty = resnum[restype], resinuse = 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2005
^1da177e4c3f415 Linus Torvalds 2005-04-16 2006 if (out) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2007 /* Gather used resources by all streams. */
^1da177e4c3f415 Linus Torvalds 2005-04-16 2008 for (i = 0; i < NR_ADB; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2009 resinuse |= vortex->dma_adb[i].resources[restype];
^1da177e4c3f415 Linus Torvalds 2005-04-16 2010 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2011 resinuse |= vortex->fixed_res[restype];
^1da177e4c3f415 Linus Torvalds 2005-04-16 2012 /* Find and take free resource. */
^1da177e4c3f415 Linus Torvalds 2005-04-16 2013 for (i = 0; i < qty; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2014 if ((resinuse & (1 << i)) == 0) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2015 if (resmap != NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16 2016 resmap[restype] |= (1 << i);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2017 else
^1da177e4c3f415 Linus Torvalds 2005-04-16 2018 vortex->dma_adb[i].resources[restype] |= (1 << i);
ee419653a38de93 Takashi Iwai 2009-02-05 2019 /*
e7e69265b626976 Sudip Mukherjee 2014-09-08 2020 pr_debug(
ee419653a38de93 Takashi Iwai 2009-02-05 2021 "vortex: ResManager: type %d out %d\n",
ee419653a38de93 Takashi Iwai 2009-02-05 2022 restype, i);
ee419653a38de93 Takashi Iwai 2009-02-05 2023 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 2024 return i;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2025 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2026 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2027 } else {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2028 if (resmap == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16 @2029 return -EINVAL;
^^^^^^^^^^^^^^^

^1da177e4c3f415 Linus Torvalds 2005-04-16 2030 /* Checkin first resource of type restype. */
^1da177e4c3f415 Linus Torvalds 2005-04-16 2031 for (i = 0; i < qty; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2032 if (resmap[restype] & (1 << i)) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2033 resmap[restype] &= ~(1 << i);
ee419653a38de93 Takashi Iwai 2009-02-05 2034 /*
e7e69265b626976 Sudip Mukherjee 2014-09-08 2035 pr_debug(
ee419653a38de93 Takashi Iwai 2009-02-05 2036 "vortex: ResManager: type %d in %d\n",
ee419653a38de93 Takashi Iwai 2009-02-05 2037 restype, i);
ee419653a38de93 Takashi Iwai 2009-02-05 2038 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 2039 return i;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2040 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2041 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2042 }
70c84418bf74f58 Sudip Mukherjee 2014-10-13 2043 dev_err(vortex->card->dev,
70c84418bf74f58 Sudip Mukherjee 2014-10-13 2044 "FATAL: ResManager: resource type %d exhausted.\n",
70c84418bf74f58 Sudip Mukherjee 2014-10-13 2045 restype);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2046 return -ENOMEM;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2047 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28999 bytes --]