Re: sound/soc/generic/simple-card.c:259:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
From: Kuninori Morimoto
Date: Tue Aug 24 2021 - 00:43:46 EST
Hi
> >> sound/soc/generic/simple-card.c:259:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
> struct device *dev = simple_priv_to_dev(priv);
> ^~~
> sound/soc/generic/simple-card.c:259:17: note: Value stored to 'dev' during its initialization is never read
> struct device *dev = simple_priv_to_dev(priv);
> ^~~
(snip)
> e59289cda8dec0 Kuninori Morimoto 2019-03-20 253 static int simple_dai_link_of(struct asoc_simple_priv *priv,
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 254 struct device_node *np,
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 255 struct device_node *codec,
> 17029e494edc68 Kuninori Morimoto 2018-12-20 256 struct link_info *li,
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 257 bool is_top)
> 6a91a17bd7b92b Jean-Francois Moine 2014-03-20 258 {
> f531913f01a072 Kuninori Morimoto 2014-09-09 @259 struct device *dev = simple_priv_to_dev(priv);
> 17029e494edc68 Kuninori Morimoto 2018-12-20 260 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
> 5bb5ac71e3f4f8 Kuninori Morimoto 2021-04-14 261 struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
> 5bb5ac71e3f4f8 Kuninori Morimoto 2021-04-14 262 struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
> 5bb5ac71e3f4f8 Kuninori Morimoto 2021-04-14 263 struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
> 1b5721b24306c2 Kuninori Morimoto 2014-10-27 264 struct device_node *cpu = NULL;
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 265 struct device_node *node = NULL;
> e0ae225b7e96e5 Jun Nie 2015-04-29 266 struct device_node *plat = NULL;
> 6ad76b573bb63e Kuninori Morimoto 2021-05-11 267 char dai_name[64];
> b3ca11ff59bc58 Jyri Sarha 2014-03-24 268 char prop[128];
> b3ca11ff59bc58 Jyri Sarha 2014-03-24 269 char *prefix = "";
> 25c4a9b614f101 Mark Brown 2021-04-23 270 int ret, single_cpu = 0;
> 6a91a17bd7b92b Jean-Francois Moine 2014-03-20 271
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 272 cpu = np;
> d947cdfd4be29c Kuninori Morimoto 2018-12-20 273 node = of_get_parent(np);
> 17029e494edc68 Kuninori Morimoto 2018-12-20 274
> 17029e494edc68 Kuninori Morimoto 2018-12-20 275 dev_dbg(dev, "link_of (%pOF)\n", node);
Ahh...,
"dev" at 259 is used only at 275 dev_dbg(dev, ...), and this
warning is for non DEBUG case.
I don't like below, but is this the only solution ?
+#ifdef DEBUG
struct device *dev = simple_priv_to_dev(priv);
+#endif
Maybe samething happen at audio-graph-card.c :: graph_dai_link_of(), too.
Thank you for your help !!
Best regards
---
Kuninori Morimoto