Re: [PATCH 2/2] ASoC: qcom: add apq8039 sound card support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pantelis,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on sound/for-next v5.8-rc1 next-20200618]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pantelis-Antoniou/ASoC-qcom-add-apq8039-sound-card-and-bindings/20200620-034022
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

sound/soc/qcom/apq8039.c: In function 'snd_soc_card_ctl_getset.constprop':
>> sound/soc/qcom/apq8039.c:176:5: warning: 'strncpy' destination unchanged after copying no bytes [-Wstringop-truncation]
176 |     strncpy(orig, uinfo->value.enumerated.name,
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177 |       origsz);
|       ~~~~~~~

vim +/strncpy +176 sound/soc/qcom/apq8039.c

    67	
    68	static int
    69	snd_soc_card_ctl_getset(struct snd_soc_card *card,
    70				const char *name,
    71				char *orig, size_t origsz, const char *value)
    72	{
    73		struct snd_kcontrol *ctl;
    74		struct snd_ctl_elem_info *uinfo = NULL;
    75		struct snd_ctl_elem_value *uctl = NULL;
    76		unsigned int i, count;
    77		int ret;
    78	
    79		/* get the control */
    80		ctl = snd_soc_card_ctl_find(card, name, NULL);
    81		if (!ctl)
    82			return -ENOENT;
    83	
    84		/* allocate info and value */
    85		uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
    86		uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
    87		if (!uinfo || !uctl) {
    88			ret = -ENOMEM;
    89			goto out_free;
    90		}
    91	
    92		ret = ctl->info(ctl, uinfo);
    93		if (ret)
    94			goto out_free;
    95		if (uinfo->count != 1) {
    96			ret = -ENOTSUPP;
    97			goto out_free;
    98		}
    99	
   100		ret = ctl->get(ctl, uctl);
   101		if (ret)
   102			goto out_free;
   103	
   104		ret = 0;
   105	
   106		switch (uinfo->type) {
   107	
   108		case SNDRV_CTL_ELEM_TYPE_NONE:
   109			break;
   110	
   111		case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
   112			if (orig && origsz > 0)
   113				snprintf(orig, origsz, "%s",
   114						uctl->value.integer.value[0] ?
   115							"true" : "false");
   116	
   117			if (value) {
   118				bool bval;
   119	
   120				ret = kstrtobool(value, &bval);
   121				if (ret)
   122					goto out_free;
   123				uctl->value.integer.value[0] = !!bval;
   124	
   125			}
   126			break;
   127	
   128		case SNDRV_CTL_ELEM_TYPE_INTEGER:
   129			if (orig && origsz > 0)
   130				snprintf(orig, origsz, "%ld",
   131						uctl->value.integer.value[0]);
   132	
   133			if (value) {
   134				ret = kstrtol(value, 10,
   135						&uctl->value.integer.value[0]);
   136				if (ret)
   137					goto out_free;
   138			}
   139			break;
   140	
   141		case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
   142			count = uinfo->value.enumerated.items;
   143	
   144			if (value) { /* set */
   145				for (i = 0; i < count; i++) {
   146					uinfo->value.enumerated.item = i;
   147					ret = ctl->info(ctl, uinfo);
   148					if (ret)
   149						goto out_free;
   150	
   151					if (!strcmp(value,
   152							uinfo->value.enumerated.name))
   153						break;
   154				}
   155	
   156				/* setting without finding the enum */
   157				if (i >= count) {
   158					ret = -EINVAL;
   159					goto out_free;
   160				}
   161				uctl->value.enumerated.item[0] = i;
   162			} else { /* get */
   163				uinfo->value.enumerated.item =
   164					uctl->value.enumerated.item[0];
   165				ret = ctl->info(ctl, uinfo);
   166				if (ret)
   167					goto out_free;
   168	
   169				if (orig && origsz) {
   170					if (origsz <
   171						strlen(uinfo->value.enumerated.name)
   172						+ 1) {
   173						ret = -ENOSPC;
   174						goto out_free;
   175					}
 > 176					strncpy(orig, uinfo->value.enumerated.name,
   177							origsz);
   178				}
   179			}
   180			break;
   181	
   182		case SNDRV_CTL_ELEM_TYPE_INTEGER64:
   183			if (orig && origsz > 0)
   184				snprintf(orig, origsz, "%lld",
   185						uctl->value.integer64.value[0]);
   186	
   187			if (value) {
   188				ret = kstrtoll(value, 10,
   189						&uctl->value.integer64.value[0]);
   190				if (ret)
   191					goto out_free;
   192			}
   193			break;
   194	
   195		case SNDRV_CTL_ELEM_TYPE_BYTES:
   196		case SNDRV_CTL_ELEM_TYPE_IEC958:
   197			ret = -ENOTSUPP;
   198			goto out_free;
   199		default:
   200			ret = -EINVAL;
   201			goto out_free;
   202		}
   203	
   204		if (value) {
   205			ret = ctl->put(ctl, uctl);
   206			if (ret < 0)
   207				goto out_free;
   208	
   209			/* if it changed, report change to user space */
   210			if (ret > 0)
   211				snd_ctl_notify(card->snd_card,
   212						SNDRV_CTL_EVENT_MASK_VALUE,
   213						&uctl->id);
   214		}
   215	
   216	out_free:
   217		kfree(uctl);
   218		kfree(uinfo);
   219	
   220		if (ret < 0)
   221			dev_err(card->dev, "%s: %s operation failed for \"%s\"",
   222					__func__, value ? "set" : "get", name);
   223	
   224		return ret;
   225	}
   226	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux