[bug report] ASoC: rsnd: add null CLOCKIN support

Dan Carpenter dan.carpenter at oracle.com
Wed Jun 9 13:31:17 CEST 2021


Hello Kuninori Morimoto,

The patch d6956a7dde6f: "ASoC: rsnd: add null CLOCKIN support" from
May 24, 2021, leads to the following static checker warning:

	sound/soc/sh/rcar/adg.c:435 rsnd_adg_get_clkin()
	warn: 'clk' isn't an ERR_PTR

sound/soc/sh/rcar/adg.c
   423  static int rsnd_adg_get_clkin(struct rsnd_priv *priv)
   424  {
   425          struct rsnd_adg *adg = priv->adg;
   426          struct device *dev = rsnd_priv_to_dev(priv);
   427          struct clk *clk;
   428          int i;
   429  
   430          for (i = 0; i < CLKMAX; i++) {
   431                  clk = devm_clk_get(dev, clk_name[i]);

If devm_clk_get() returns NULL that's not an error.


   432  
   433                  if (IS_ERR(clk))
   434                          clk = rsnd_adg_null_clk_get(priv);

But I think if rsnd_adg_null_clk_get() returns an error then it is an
error.


   435                  if (IS_ERR(clk))

This is impossible.

   436                          goto err;

So I think it should be:

			if (IS_ERR(clk)) {
				clk = rsnd_adg_null_clk_get(priv);
				if (!clk)
					goto err;
			}

   437  
   438                  adg->clk[i] = clk;
   439          }
   440  
   441          return 0;
   442  
   443  err:
   444          dev_err(dev, "adg clock IN get failed\n");
   445  
   446          rsnd_adg_null_clk_clean(priv);
   447  
   448          return -EIO;
   449  }

regards,
dan carpenter


More information about the Alsa-devel mailing list