[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202009300009.C61sY05W-lkp@intel.com>
Date: Wed, 30 Sep 2020 00:56:13 +0800
From: kernel test robot <lkp@...el.com>
To: Shengjiu Wang <shengjiu.wang@....com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Mark Brown <broonie@...nel.org>
Subject: sound/soc/fsl/fsl-asoc-card.c:684:45: sparse: sparse: incorrect type
in argument 3 (different base types)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fb0155a09b0224a7147cb07a4ce6034c8d29667f
commit: 859e364302c510cfdd9abda13a3c4c1d1bc68c57 ASoC: fsl-asoc-card: Support new property fsl, asrc-format
date: 5 months ago
config: h8300-randconfig-s032-20200929 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-201-g24bdaac6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=859e364302c510cfdd9abda13a3c4c1d1bc68c57
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 859e364302c510cfdd9abda13a3c4c1d1bc68c57
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
echo
echo "sparse warnings: (new ones prefixed by >>)"
echo
>> sound/soc/fsl/fsl-asoc-card.c:684:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] *out_value @@ got restricted snd_pcm_format_t * @@
>> sound/soc/fsl/fsl-asoc-card.c:684:45: sparse: expected unsigned int [usertype] *out_value
sound/soc/fsl/fsl-asoc-card.c:684:45: sparse: got restricted snd_pcm_format_t *
vim +684 sound/soc/fsl/fsl-asoc-card.c
480
481 static int fsl_asoc_card_probe(struct platform_device *pdev)
482 {
483 struct device_node *cpu_np, *codec_np, *asrc_np;
484 struct device_node *np = pdev->dev.of_node;
485 struct platform_device *asrc_pdev = NULL;
486 struct platform_device *cpu_pdev;
487 struct fsl_asoc_card_priv *priv;
488 struct i2c_client *codec_dev;
489 const char *codec_dai_name;
490 u32 width;
491 int ret;
492
493 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
494 if (!priv)
495 return -ENOMEM;
496
497 cpu_np = of_parse_phandle(np, "audio-cpu", 0);
498 /* Give a chance to old DT binding */
499 if (!cpu_np)
500 cpu_np = of_parse_phandle(np, "ssi-controller", 0);
501 if (!cpu_np) {
502 dev_err(&pdev->dev, "CPU phandle missing or invalid\n");
503 ret = -EINVAL;
504 goto fail;
505 }
506
507 cpu_pdev = of_find_device_by_node(cpu_np);
508 if (!cpu_pdev) {
509 dev_err(&pdev->dev, "failed to find CPU DAI device\n");
510 ret = -EINVAL;
511 goto fail;
512 }
513
514 codec_np = of_parse_phandle(np, "audio-codec", 0);
515 if (codec_np)
516 codec_dev = of_find_i2c_device_by_node(codec_np);
517 else
518 codec_dev = NULL;
519
520 asrc_np = of_parse_phandle(np, "audio-asrc", 0);
521 if (asrc_np)
522 asrc_pdev = of_find_device_by_node(asrc_np);
523
524 /* Get the MCLK rate only, and leave it controlled by CODEC drivers */
525 if (codec_dev) {
526 struct clk *codec_clk = clk_get(&codec_dev->dev, NULL);
527
528 if (!IS_ERR(codec_clk)) {
529 priv->codec_priv.mclk_freq = clk_get_rate(codec_clk);
530 clk_put(codec_clk);
531 }
532 }
533
534 /* Default sample rate and format, will be updated in hw_params() */
535 priv->sample_rate = 44100;
536 priv->sample_format = SNDRV_PCM_FORMAT_S16_LE;
537
538 /* Assign a default DAI format, and allow each card to overwrite it */
539 priv->dai_fmt = DAI_FMT_BASE;
540
541 /* Diversify the card configurations */
542 if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
543 codec_dai_name = "cs42888";
544 priv->card.set_bias_level = NULL;
545 priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq;
546 priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq;
547 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
548 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
549 priv->cpu_priv.slot_width = 32;
550 priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
551 } else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) {
552 codec_dai_name = "cs4271-hifi";
553 priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK;
554 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
555 } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
556 codec_dai_name = "sgtl5000";
557 priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
558 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
559 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
560 codec_dai_name = "wm8962";
561 priv->card.set_bias_level = fsl_asoc_card_set_bias_level;
562 priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK;
563 priv->codec_priv.fll_id = WM8962_SYSCLK_FLL;
564 priv->codec_priv.pll_id = WM8962_FLL;
565 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
566 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) {
567 codec_dai_name = "wm8960-hifi";
568 priv->card.set_bias_level = fsl_asoc_card_set_bias_level;
569 priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO;
570 priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO;
571 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
572 } else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) {
573 codec_dai_name = "ac97-hifi";
574 priv->card.set_bias_level = NULL;
575 priv->dai_fmt = SND_SOC_DAIFMT_AC97;
576 } else {
577 dev_err(&pdev->dev, "unknown Device Tree compatible\n");
578 ret = -EINVAL;
579 goto asrc_fail;
580 }
581
582 if (!fsl_asoc_card_is_ac97(priv) && !codec_dev) {
583 dev_err(&pdev->dev, "failed to find codec device\n");
584 ret = -EINVAL;
585 goto asrc_fail;
586 }
587
588 /* Common settings for corresponding Freescale CPU DAI driver */
589 if (of_node_name_eq(cpu_np, "ssi")) {
590 /* Only SSI needs to configure AUDMUX */
591 ret = fsl_asoc_card_audmux_init(np, priv);
592 if (ret) {
593 dev_err(&pdev->dev, "failed to init audmux\n");
594 goto asrc_fail;
595 }
596 } else if (of_node_name_eq(cpu_np, "esai")) {
597 priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
598 priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL;
599 } else if (of_node_name_eq(cpu_np, "sai")) {
600 priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1;
601 priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1;
602 }
603
604 snprintf(priv->name, sizeof(priv->name), "%s-audio",
605 fsl_asoc_card_is_ac97(priv) ? "ac97" :
606 codec_dev->name);
607
608 /* Initialize sound card */
609 priv->pdev = pdev;
610 priv->card.dev = &pdev->dev;
611 priv->card.name = priv->name;
612 priv->card.dai_link = priv->dai_link;
613 priv->card.dapm_routes = fsl_asoc_card_is_ac97(priv) ?
614 audio_map_ac97 : audio_map;
615 priv->card.late_probe = fsl_asoc_card_late_probe;
616 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
617 priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets;
618 priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets);
619
620 /* Drop the second half of DAPM routes -- ASRC */
621 if (!asrc_pdev)
622 priv->card.num_dapm_routes /= 2;
623
624 memcpy(priv->dai_link, fsl_asoc_card_dai,
625 sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link));
626
627 ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing");
628 if (ret) {
629 dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret);
630 goto asrc_fail;
631 }
632
633 /* Normal DAI Link */
634 priv->dai_link[0].cpus->of_node = cpu_np;
635 priv->dai_link[0].codecs->dai_name = codec_dai_name;
636
637 if (!fsl_asoc_card_is_ac97(priv))
638 priv->dai_link[0].codecs->of_node = codec_np;
639 else {
640 u32 idx;
641
642 ret = of_property_read_u32(cpu_np, "cell-index", &idx);
643 if (ret) {
644 dev_err(&pdev->dev,
645 "cannot get CPU index property\n");
646 goto asrc_fail;
647 }
648
649 priv->dai_link[0].codecs->name =
650 devm_kasprintf(&pdev->dev, GFP_KERNEL,
651 "ac97-codec.%u",
652 (unsigned int)idx);
653 if (!priv->dai_link[0].codecs->name) {
654 ret = -ENOMEM;
655 goto asrc_fail;
656 }
657 }
658
659 priv->dai_link[0].platforms->of_node = cpu_np;
660 priv->dai_link[0].dai_fmt = priv->dai_fmt;
661 priv->card.num_links = 1;
662
663 if (asrc_pdev) {
664 /* DPCM DAI Links only if ASRC exsits */
665 priv->dai_link[1].cpus->of_node = asrc_np;
666 priv->dai_link[1].platforms->of_node = asrc_np;
667 priv->dai_link[2].codecs->dai_name = codec_dai_name;
668 priv->dai_link[2].codecs->of_node = codec_np;
669 priv->dai_link[2].codecs->name =
670 priv->dai_link[0].codecs->name;
671 priv->dai_link[2].cpus->of_node = cpu_np;
672 priv->dai_link[2].dai_fmt = priv->dai_fmt;
673 priv->card.num_links = 3;
674
675 ret = of_property_read_u32(asrc_np, "fsl,asrc-rate",
676 &priv->asrc_rate);
677 if (ret) {
678 dev_err(&pdev->dev, "failed to get output rate\n");
679 ret = -EINVAL;
680 goto asrc_fail;
681 }
682
683 ret = of_property_read_u32(asrc_np, "fsl,asrc-format",
> 684 &priv->asrc_format);
685 if (ret) {
686 /* Fallback to old binding; translate to asrc_format */
687 ret = of_property_read_u32(asrc_np, "fsl,asrc-width",
688 &width);
689 if (ret) {
690 dev_err(&pdev->dev,
691 "failed to decide output format\n");
692 goto asrc_fail;
693 }
694
695 if (width == 24)
696 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
697 else
698 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
699 }
700 }
701
702 /* Finish card registering */
703 platform_set_drvdata(pdev, priv);
704 snd_soc_card_set_drvdata(&priv->card, priv);
705
706 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
707 if (ret && ret != -EPROBE_DEFER)
708 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
709
710 asrc_fail:
711 of_node_put(asrc_np);
712 of_node_put(codec_np);
713 put_device(&cpu_pdev->dev);
714 fail:
715 of_node_put(cpu_np);
716
717 return ret;
718 }
719
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (33044 bytes)
Powered by blists - more mailing lists