[<prev] [next>] [day] [month] [year] [list]
Message-ID: <dd683985-6aac-43e0-8116-92f2c587874d@stanley.mountain>
Date: Mon, 9 Dec 2024 09:36:51 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>
Subject: sound/soc/renesas/rcar/adg.c:416 rsnd_adg_create_null_clk() warn:
passing zero to 'ERR_CAST'
Hi Lad,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b5f217084ab3ddd4bdd03cd437f8e3b7e2d1f5b6
commit: c087a94bea49acf34d651f7308506fe462a937b3 ASoC: Rename "sh" to "renesas"
config: openrisc-randconfig-r071-20241206 (https://download.01.org/0day-ci/archive/20241207/202412071740.OKhNHftG-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202412071740.OKhNHftG-lkp@intel.com/
smatch warnings:
sound/soc/renesas/rcar/adg.c:416 rsnd_adg_create_null_clk() warn: passing zero to 'ERR_CAST'
sound/soc/renesas/rcar/dma.c:840 rsnd_dma_attach() error: we previously assumed '*dma_mod' could be null (see line 833)
vim +/ERR_CAST +416 sound/soc/renesas/rcar/adg.c
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 406 static struct clk *rsnd_adg_create_null_clk(struct rsnd_priv *priv,
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 407 const char * const name,
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 408 const char *parent)
d6956a7dde6fbf8 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-05-24 409 {
d6956a7dde6fbf8 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-05-24 410 struct device *dev = rsnd_priv_to_dev(priv);
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 411 struct clk *clk;
d6956a7dde6fbf8 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-05-24 412
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 413 clk = clk_register_fixed_rate(dev, name, parent, 0, 0);
cc64c390b215b40 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-08-20 414 if (IS_ERR_OR_NULL(clk)) {
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 415 dev_err(dev, "create null clk error\n");
cc64c390b215b40 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-08-20 @416 return ERR_CAST(clk);
This driver doesn't check for error pointers in the right way.
https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
If a function returns NULL and error pointers the NULL generally means
it's an optional feature. For example, an ethernet card can transmit
packets just fine without blinking LEDs. The driver has to be written
to handle the NULL pointer.
Here I guess clk_register_fixed_rate() is optional and has been
deliberately turned off but we're printing an error and then returning
NULL back to the caller. The callers check for NULL and change it to
an -EIO. It's shouldn't print an error if it's deliberate. Or if the
driver can't operate without the feature then that dependency should be
enforced in the Kconfig.
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 417 }
d6956a7dde6fbf8 sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-05-24 418
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 419 return clk;
cb2f97d89f383da sound/soc/sh/rcar/adg.c Kuninori Morimoto 2021-06-02 420 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists