diff mbox series

[5/8] ASoC: sh: rcar: ctu: add missing error check

Message ID 20210219231635.5749-6-pierre-louis.bossart@linux.intel.com (mailing list archive)
State Accepted
Commit 4862811f87350c3656e86dfc3ce310d0390d48ab
Headers show
Series ASoC: sh: remove cppcheck warnings | expand

Commit Message

Pierre-Louis Bossart Feb. 19, 2021, 11:16 p.m. UTC
cppcheck warning:

sound/soc/sh/rcar/ctu.c:212:6: style: Variable 'ret' is reassigned a
value before the old one has been used. [redundantAssignment]
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU SV0",
     ^
sound/soc/sh/rcar/ctu.c:205:6: note: ret is assigned
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU Pass",
     ^
sound/soc/sh/rcar/ctu.c:212:6: note: ret is overwritten
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU SV0",
     ^

All the kcontrol creations are checked for errors, except for one. Add
the missing error check.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sh/rcar/ctu.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
index 7647b3d4c0ba..20eecd088d13 100644
--- a/sound/soc/sh/rcar/ctu.c
+++ b/sound/soc/sh/rcar/ctu.c
@@ -207,6 +207,8 @@  static int rsnd_ctu_pcm_new(struct rsnd_mod *mod,
 			       NULL,
 			       &ctu->pass, RSND_MAX_CHANNELS,
 			       0xC);
+	if (ret < 0)
+		return ret;
 
 	/* ROW0 */
 	ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU SV0",