[bug report] ASoC: fsl-asoc-card: Add MQS support

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

 



Hello Shengjiu Wang,

Commit 039652a5b965 ("ASoC: fsl-asoc-card: Add MQS support") from Jun
17, 2020 (linux-next), leads to the following Smatch static checker
warning:

	sound/soc/fsl/fsl-asoc-card.c:796 fsl_asoc_card_probe()
	error: uninitialized symbol 'codec_dev_name'.

sound/soc/fsl/fsl-asoc-card.c
    542 static int fsl_asoc_card_probe(struct platform_device *pdev)
    543 {
    544         struct device_node *cpu_np, *codec_np, *asrc_np;
    545         struct device_node *np = pdev->dev.of_node;
    546         struct platform_device *asrc_pdev = NULL;
    547         struct device_node *bitclkprovider = NULL;
    548         struct device_node *frameprovider = NULL;
    549         struct platform_device *cpu_pdev;
    550         struct fsl_asoc_card_priv *priv;
    551         struct device *codec_dev = NULL;
    552         const char *codec_dai_name;
    553         const char *codec_dev_name;
    554         u32 asrc_fmt = 0;
    555         u32 width;
    556         int ret;
    557 
    558         priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
    559         if (!priv)
    560                 return -ENOMEM;
    561 
    562         cpu_np = of_parse_phandle(np, "audio-cpu", 0);
    563         /* Give a chance to old DT binding */
    564         if (!cpu_np)
    565                 cpu_np = of_parse_phandle(np, "ssi-controller", 0);
    566         if (!cpu_np) {
    567                 dev_err(&pdev->dev, "CPU phandle missing or invalid\n");
    568                 ret = -EINVAL;
    569                 goto fail;
    570         }
    571 
    572         cpu_pdev = of_find_device_by_node(cpu_np);
    573         if (!cpu_pdev) {
    574                 dev_err(&pdev->dev, "failed to find CPU DAI device\n");
    575                 ret = -EINVAL;
    576                 goto fail;
    577         }
    578 
    579         codec_np = of_parse_phandle(np, "audio-codec", 0);
    580         if (codec_np) {
    581                 struct platform_device *codec_pdev;
    582                 struct i2c_client *codec_i2c;
    583 
    584                 codec_i2c = of_find_i2c_device_by_node(codec_np);
    585                 if (codec_i2c) {
    586                         codec_dev = &codec_i2c->dev;
    587                         codec_dev_name = codec_i2c->name;
    588                 }
    589                 if (!codec_dev) {
    590                         codec_pdev = of_find_device_by_node(codec_np);
    591                         if (codec_pdev) {
    592                                 codec_dev = &codec_pdev->dev;
    593                                 codec_dev_name = codec_pdev->name;
    594                         }
    595                 }

There are a bunch of ways that codec_dev_name can end up uninitialized.

    596         }
    597 
    598         asrc_np = of_parse_phandle(np, "audio-asrc", 0);
    599         if (asrc_np)
    600                 asrc_pdev = of_find_device_by_node(asrc_np);
    601 
    602         /* Get the MCLK rate only, and leave it controlled by CODEC drivers */
    603         if (codec_dev) {
    604                 struct clk *codec_clk = clk_get(codec_dev, NULL);
    605 

[ Snip ]

    789         /* Initialize sound card */
    790         priv->pdev = pdev;
    791         priv->card.dev = &pdev->dev;
    792         priv->card.owner = THIS_MODULE;
    793         ret = snd_soc_of_parse_card_name(&priv->card, "model");
    794         if (ret) {
    795                 snprintf(priv->name, sizeof(priv->name), "%s-audio",
--> 796                          fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name);

Used in error handling only.

    797                 priv->card.name = priv->name;
    798         }
    799         priv->card.dai_link = priv->dai_link;
    800         priv->card.late_probe = fsl_asoc_card_late_probe;
 
regards,
dan carpenter



[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