From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Brian Austin <brian.austin@cirrus.com>,
Mark Brown <broonie@kernel.org>,
Arnaud Pouliquen <arnaud.pouliquen@st.com>,
Liam Girdwood <lgirdwood@gmail.com>
Subject: Missing return check of of_property_read_*()
Date: Wed, 09 Sep 2015 16:40:36 +0200 [thread overview]
Message-ID: <s5hlhcfd5az.wl-tiwai@suse.de> (raw)
Hi,
I hoped that I wouldn't need to write this kind of post, but since
nothing happened so far, so here we go:
The following compile warnings are present for quite some time. They
are due to the lack of return check from of_property_read*().
sound/soc/codecs/cs35l32.c: In function ‘cs35l32_i2c_probe’:
sound/soc/codecs/cs35l32.c:278:2: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
switch (val) {
^
sound/soc/codecs/cs35l32.c:272:15: note: ‘val’ was declared here
unsigned int val;
^
sound/soc/sti/uniperif_player.c: In function ‘uni_player_init’:
sound/soc/sti/uniperif_player.c:1006:6: warning: ‘mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (strcasecmp(mode, "hdmi") == 0)
^
sound/soc/sti/uniperif_player.c:985:14: note: ‘mode’ was declared here
const char *mode;
^
Both should be trivial to fix, but I won't bother to fix these things
by myself, as it results always in a matter of taste how to write.
So, please fix them appropriately.
Although not shown as compile warning like the above, lots of codec
drivers have no return value checks from of_property_read*(), too.
A quick grep reveals:
% git grep -B1 '^[[:space:]]*of_property_read_' sound/soc
sound/soc/codecs/adau1701.c-
sound/soc/codecs/adau1701.c: of_property_read_u32(dev->of_node, "adi,pll-clkdiv",
--
sound/soc/codecs/adau1701.c-
sound/soc/codecs/adau1701.c: of_property_read_u8_array(dev->of_node, "adi,pin-config",
--
sound/soc/codecs/cs35l32.c-
sound/soc/codecs/cs35l32.c: of_property_read_u32(np, "cirrus,boost-manager", &val);
--
sound/soc/codecs/cs35l32.c-
sound/soc/codecs/cs35l32.c: of_property_read_u32(np, "cirrus,sdout-datacfg", &val);
--
sound/soc/codecs/cs35l32.c-
sound/soc/codecs/cs35l32.c: of_property_read_u32(np, "cirrus,battery-threshold", &val);
--
sound/soc/codecs/cs35l32.c-
sound/soc/codecs/cs35l32.c: of_property_read_u32(np, "cirrus,battery-recovery", &val);
--
sound/soc/codecs/sta32x.c-
sound/soc/codecs/sta32x.c: of_property_read_u8(np, "st,output-conf",
sound/soc/codecs/sta32x.c- &pdata->output_conf);
sound/soc/codecs/sta32x.c: of_property_read_u8(np, "st,ch1-output-mapping",
sound/soc/codecs/sta32x.c- &pdata->ch1_output_mapping);
sound/soc/codecs/sta32x.c: of_property_read_u8(np, "st,ch2-output-mapping",
sound/soc/codecs/sta32x.c- &pdata->ch2_output_mapping);
sound/soc/codecs/sta32x.c: of_property_read_u8(np, "st,ch3-output-mapping",
--
sound/soc/codecs/sta32x.c- tmp = 140;
sound/soc/codecs/sta32x.c: of_property_read_u16(np, "st,drop-compensation-ns", &tmp);
--
sound/soc/codecs/sta350.c-
sound/soc/codecs/sta350.c: of_property_read_u8(np, "st,output-conf",
sound/soc/codecs/sta350.c- &pdata->output_conf);
sound/soc/codecs/sta350.c: of_property_read_u8(np, "st,ch1-output-mapping",
sound/soc/codecs/sta350.c- &pdata->ch1_output_mapping);
sound/soc/codecs/sta350.c: of_property_read_u8(np, "st,ch2-output-mapping",
sound/soc/codecs/sta350.c- &pdata->ch2_output_mapping);
sound/soc/codecs/sta350.c: of_property_read_u8(np, "st,ch3-output-mapping",
--
sound/soc/codecs/sta350.c- tmp = 140;
sound/soc/codecs/sta350.c: of_property_read_u16(np, "st,drop-compensation-ns", &tmp);
--
sound/soc/codecs/tas5086.c-
sound/soc/codecs/tas5086.c: of_property_read_u32(of_node, "ti,charge-period",
--
sound/soc/codecs/tlv320aic31xx.c-
sound/soc/codecs/tlv320aic31xx.c: of_property_read_u32(np, "ai31xx-micbias-vg", &value);
--
sound/soc/codecs/twl4030.c-
sound/soc/codecs/twl4030.c: of_property_read_u32(node, "ti,digimic_delay",
sound/soc/codecs/twl4030.c- &pdata->digimic_delay);
sound/soc/codecs/twl4030.c: of_property_read_u32(node, "ti,ramp_delay_value",
sound/soc/codecs/twl4030.c- &pdata->ramp_delay_value);
sound/soc/codecs/twl4030.c: of_property_read_u32(node, "ti,offset_cncl_path",
--
sound/soc/fsl/fsl_esai.c- esai_priv->synchronous =
sound/soc/fsl/fsl_esai.c: of_property_read_bool(np, "fsl,esai-synchronous");
--
sound/soc/omap/omap-abe-twl6040.c- priv->jack_detection = of_property_read_bool(node, "ti,jack-detection");
sound/soc/omap/omap-abe-twl6040.c: of_property_read_u32(node, "ti,mclk-freq", &priv->mclk_freq);
--
sound/soc/samsung/i2s.c- }
sound/soc/samsung/i2s.c: of_property_read_string_index(dev->of_node,
--
sound/soc/sh/rcar/rsrc-card.c- /* sampling rate convert */
sound/soc/sh/rcar/rsrc-card.c: of_property_read_u32(node, "convert-rate", &priv->convert_rate);
--
sound/soc/sti/uniperif_player.c-
sound/soc/sti/uniperif_player.c: of_property_read_u32(pnode, "version", &player->ver);
--
sound/soc/sti/uniperif_player.c-
sound/soc/sti/uniperif_player.c: of_property_read_u32(pnode, "uniperiph-id", &info->id);
--
sound/soc/sti/uniperif_player.c- /* Read the device mode property */
sound/soc/sti/uniperif_player.c: of_property_read_string(pnode, "mode", &mode);
--
sound/soc/sti/uniperif_reader.c-
sound/soc/sti/uniperif_reader.c: of_property_read_u32(node, "version", &reader->ver);
Many of them look really buggy (while some have the default value to
fall back). And many codes have even no value checks. These should
be fixed as well.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next reply other threads:[~2015-09-09 14:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 14:40 Takashi Iwai [this message]
2015-09-09 14:51 ` Missing return check of of_property_read_*() Mark Brown
2015-09-09 14:55 ` Brian Austin
2015-09-09 15:05 ` Takashi Iwai
2015-09-09 15:57 ` Mark Brown
2015-09-09 16:01 ` Takashi Iwai
2015-09-09 16:19 ` Mark Brown
2015-09-09 16:27 ` Takashi Iwai
2015-09-10 3:10 ` Fengguang Wu
2015-09-10 3:23 ` Fengguang Wu
2015-09-10 5:32 ` Takashi Iwai
2015-09-10 5:45 ` Takashi Iwai
2015-09-10 6:24 ` Fengguang Wu
2015-09-10 10:54 ` Mark Brown
2015-09-10 11:17 ` Fengguang Wu
2015-09-10 18:19 ` Mark Brown
2015-09-09 15:13 ` Mark Brown
2015-09-09 15:01 ` Takashi Iwai
2015-09-09 15:05 ` Lars-Peter Clausen
2015-09-09 15:07 ` Takashi Iwai
2015-09-09 15:33 ` Mark Brown
2015-10-02 10:34 ` Question about patch ASoC: Prevent components from being bound to multiple cards Koro Chen
2015-10-02 14:48 ` Mark Brown
2015-10-03 15:01 ` Koro Chen
2015-10-05 10:07 ` Mark Brown
2015-10-05 10:08 ` Mark Brown
2015-10-05 11:28 ` Koro Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hlhcfd5az.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@st.com \
--cc=brian.austin@cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.