sound/pci/hda/hda_auto_parser.c:1021:6: warning: %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]

From: kernel test robot
Date: Tue Jan 25 2022 - 14:18:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a08b41ab9e2e468647f78eb17c28e29b93006394
commit: a235d5b8e550fac7520410440bcc8003fb4cf8d0 ALSA: hda: Allow model option to specify PCI SSID alias
date: 5 months ago
compiler: nds32le-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


cppcheck warnings: (new ones prefixed by >>)
>> sound/pci/hda/hda_auto_parser.c:1021:6: warning: %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {
^
sound/pci/hda/hda_auto_parser.c:1021:6: warning: %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {
^

vim +1021 sound/pci/hda/hda_auto_parser.c

961
962 /**
963 * snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string
964 * @codec: the HDA codec
965 * @models: NULL-terminated model string list
966 * @quirk: zero-terminated PCI/codec SSID quirk list
967 * @fixlist: the fixup list
968 *
969 * Pick up a fixup entry matching with the given model string or SSID.
970 * If a fixup was already set beforehand, the function doesn't do anything.
971 * When a special model string "nofixup" is given, also no fixup is applied.
972 *
973 * The function tries to find the matching model name at first, if given.
974 * If the model string contains the SSID alias, try to look up with the given
975 * alias ID.
976 * If nothing matched, try to look up the PCI SSID.
977 * If still nothing matched, try to look up the codec SSID.
978 */
979 void snd_hda_pick_fixup(struct hda_codec *codec,
980 const struct hda_model_fixup *models,
981 const struct snd_pci_quirk *quirk,
982 const struct hda_fixup *fixlist)
983 {
984 const struct snd_pci_quirk *q;
985 int id = HDA_FIXUP_ID_NOT_SET;
986 const char *name = NULL;
987 const char *type = NULL;
988 int vendor, device;
989
990 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
991 return;
992
993 /* when model=nofixup is given, don't pick up any fixups */
994 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
995 id = HDA_FIXUP_ID_NO_FIXUP;
996 fixlist = NULL;
997 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n",
998 codec->core.chip_name);
999 goto found;
1000 }
1001
1002 /* match with the model name string */
1003 if (codec->modelname && models) {
1004 while (models->name) {
1005 if (!strcmp(codec->modelname, models->name)) {
1006 id = models->id;
1007 name = models->name;
1008 codec_dbg(codec, "%s: picked fixup %s (model specified)\n",
1009 codec->core.chip_name, codec->fixup_name);
1010 goto found;
1011 }
1012 models++;
1013 }
1014 }
1015
1016 if (!quirk)
1017 return;
1018
1019 /* match with the SSID alias given by the model string "XXXX:YYYY" */
1020 if (codec->modelname &&
> 1021 sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {

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