[PATCH 0/8] ASoC: sh: remove cppcheck warnings
No functional changes except for patch 4 where a missing error check was added for consistency.
Pierre-Louis Bossart (8): ASoC: sh: dma-sh7760: remove unused variable ASoC: sh: rcar: align function prototypes ASoC: sh: rcar: simplify return ASoC: sh: rcar: core: rename shadowing variables ASoC: sh: rcar: ctu: add missing error check ASoC: sh: rcar: ssi: remove redundant assignment ASoC: sh: siu_pcm: remove useless assignment ASoC: sh: siu_pcm: remove unused variable
sound/soc/sh/dma-sh7760.c | 1 - sound/soc/sh/rcar/core.c | 14 +++++++------- sound/soc/sh/rcar/ctu.c | 2 ++ sound/soc/sh/rcar/rsnd.h | 6 +++--- sound/soc/sh/rcar/ssi.c | 1 - sound/soc/sh/siu_pcm.c | 6 +----- 6 files changed, 13 insertions(+), 17 deletions(-)
cppcheck warning:
sound/soc/sh/dma-sh7760.c:180:6: style: Unused variable: ret [unusedVariable] int ret; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/dma-sh7760.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index b70068dd5a06..121e48f984c5 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -177,7 +177,6 @@ static int camelot_hw_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id]; int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; - int ret;
if (recv) { cam->rx_period_size = params_period_bytes(hw_params);
cppcheck warnings:
sound/soc/sh/rcar/adg.c:208:51: style:inconclusive: Function 'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration 'mod' definition 'cmd_mod'. [funcArgNamesDifferent] int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod, ^ sound/soc/sh/rcar/rsnd.h:608:51: note: Function 'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration 'mod' definition 'cmd_mod'. int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod, ^ sound/soc/sh/rcar/adg.c:208:51: note: Function 'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration 'mod' definition 'cmd_mod'. int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod, ^ sound/soc/sh/rcar/adg.c:322:44: style:inconclusive: Function 'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod' definition 'ssi_mod'. [funcArgNamesDifferent] int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod) ^ sound/soc/sh/rcar/rsnd.h:600:44: note: Function 'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod' definition 'ssi_mod'. int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod); ^ sound/soc/sh/rcar/adg.c:322:44: note: Function 'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod' definition 'ssi_mod'. int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod) ^ sound/soc/sh/rcar/adg.c:329:49: style:inconclusive: Function 'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration 'mod' definition 'ssi_mod'. [funcArgNamesDifferent] int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate) ^ sound/soc/sh/rcar/rsnd.h:601:49: note: Function 'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration 'mod' definition 'ssi_mod'. int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate); ^ sound/soc/sh/rcar/adg.c:329:49: note: Function 'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration 'mod' definition 'ssi_mod'. int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate) ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/rcar/rsnd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 6b519370fd64..1255a85151db 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -597,15 +597,15 @@ phys_addr_t rsnd_gen_get_phy_addr(struct rsnd_priv *priv, int reg_id); * R-Car ADG */ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate); -int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod); -int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate); +int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod); +int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate); int rsnd_adg_probe(struct rsnd_priv *priv); void rsnd_adg_remove(struct rsnd_priv *priv); int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, struct rsnd_dai_stream *io, unsigned int in_rate, unsigned int out_rate); -int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod, +int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod, struct rsnd_dai_stream *io); #define rsnd_adg_clk_enable(priv) rsnd_adg_clk_control(priv, 1) #define rsnd_adg_clk_disable(priv) rsnd_adg_clk_control(priv, 0)
cppcheck warning:
sound/soc/sh/rcar/core.c:219:9: warning: Identical condition and return expression 'ret', return value is always 0 [identicalConditionAfterEarlyExit] return ret; ^ sound/soc/sh/rcar/core.c:210:6: note: If condition 'ret' is true, the function will return/exit if (ret) ^ sound/soc/sh/rcar/core.c:219:9: note: Returning identical expression 'ret' return ret; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/rcar/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index c405bf3b4c99..b1a75509851a 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -216,7 +216,7 @@ int rsnd_mod_init(struct rsnd_priv *priv, mod->clk = clk; mod->priv = priv;
- return ret; + return 0; }
void rsnd_mod_quit(struct rsnd_mod *mod)
cppcheck warnings:
sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1338:19: note: Shadowed declaration struct rsnd_dai *rdai; ^ sound/soc/sh/rcar/core.c:1369:22: note: Shadow variable struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1380:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1338:19: note: Shadowed declaration struct rsnd_dai *rdai; ^ sound/soc/sh/rcar/core.c:1380:22: note: Shadow variable struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
use a different name at lower scope.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/rcar/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index b1a75509851a..817eea79e0d2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1366,10 +1366,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_endpoint_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + struct rsnd_dai *dai = rsnd_rdai_get(priv, dai_i);
- rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); - rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); + rsnd_parse_connect_graph(priv, &dai->playback, dai_np); + rsnd_parse_connect_graph(priv, &dai->capture, dai_np); } dai_i++; } @@ -1377,10 +1377,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_child_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + struct rsnd_dai *dai = rsnd_rdai_get(priv, dai_i);
- rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); - rsnd_parse_connect_simple(priv, &rdai->capture, dai_np); + rsnd_parse_connect_simple(priv, &dai->playback, dai_np); + rsnd_parse_connect_simple(priv, &dai->capture, dai_np); } dai_i++; }
Hi Pierre-Louis
sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^
I'm not 100% sure about this warning, but this path is overkill. Maybe below is enough ?
--------- diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 8533aa696183..cae9639c0ef9 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1382,7 +1382,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_endpoint_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + rdai = rsnd_rdai_get(priv, dai_i);
rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); @@ -1393,7 +1393,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_child_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + rdai = rsnd_rdai_get(priv, dai_i);
rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); rsnd_parse_connect_simple(priv, &rdai->capture, dai_np); ----
Thank you for your help !!
Best regards --- Kuninori Morimoto
On 2/21/21 5:27 PM, Kuninori Morimoto wrote:
Hi Pierre-Louis
sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^
I'm not 100% sure about this warning, but this path is overkill. Maybe below is enough ?
Hi Morimoto-san, It might be better if we drop this patch from the series and have you send the proper fix with my Reported-by tag. Would that work for you? Thanks!
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 8533aa696183..cae9639c0ef9 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1382,7 +1382,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_endpoint_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) {
struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
rdai = rsnd_rdai_get(priv, dai_i); rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); rsnd_parse_connect_graph(priv, &rdai->capture, dai_np);
@@ -1393,7 +1393,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_child_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) {
struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
rdai = rsnd_rdai_get(priv, dai_i); rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); rsnd_parse_connect_simple(priv, &rdai->capture, dai_np);
Thank you for your help !!
Best regards
Kuninori Morimoto
Hi Pierre-Louis
sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^
I'm not 100% sure about this warning, but this path is overkill. Maybe below is enough ?
Hi Morimoto-san, It might be better if we drop this patch from the series and have you send the proper fix with my Reported-by tag. Would that work for you?
OK, thanks. Will do today
Thank you for your help !!
Best regards --- Kuninori Morimoto
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 --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",
cppcheck warning:
sound/soc/sh/rcar/ssi.c:403:6: style: Redundant initialization for 'wsr'. The initialized value is overwritten before it is read. [redundantInitialization] wsr = ssi->wsr; ^ sound/soc/sh/rcar/ssi.c:372:11: note: wsr is initialized u32 wsr = ssi->wsr; ^ sound/soc/sh/rcar/ssi.c:403:6: note: wsr is overwritten wsr = ssi->wsr; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/rcar/ssi.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index d0ded427a836..659b25992ff2 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -400,7 +400,6 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, * see * rsnd_ssiu_init_gen2() */ - wsr = ssi->wsr; if (is_tdm || is_tdm_split) { wsr |= WS_MODE; cr_own |= CHNL_8;
cppcheck warning:
sound/soc/sh/siu_pcm.c:375:5: style: Redundant initialization for 'rt'. The initialized value is overwritten before it is read. [redundantInitialization]
rt = siu_stream->substream->runtime; ^ sound/soc/sh/siu_pcm.c:366:30: note: rt is initialized struct snd_pcm_runtime *rt = ss->runtime; ^ sound/soc/sh/siu_pcm.c:375:5: note: rt is overwritten rt = siu_stream->substream->runtime; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/siu_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index 4785886df4f0..6496300f73a9 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c @@ -363,7 +363,7 @@ static int siu_pcm_prepare(struct snd_soc_component *component, struct siu_info *info = siu_i2s_data; struct siu_port *port_info = siu_port_info(ss); struct device *dev = ss->pcm->card->dev; - struct snd_pcm_runtime *rt = ss->runtime; + struct snd_pcm_runtime *rt; struct siu_stream *siu_stream; snd_pcm_sframes_t xfer_cnt;
cppcheck warning:
sound/soc/sh/siu_pcm.c:225:8: style: Variable 'virt' is assigned a value that is never used. [unreadVariable]
virt = PERIOD_OFFSET(rt->dma_area, ^
It's not clear what this variable was needed for, remove it.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sh/siu_pcm.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index 6496300f73a9..0a8a3c314a73 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c @@ -217,14 +217,10 @@ static void siu_io_work(struct work_struct *work) if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { dma_addr_t buff; size_t count; - u8 *virt;
buff = (dma_addr_t)PERIOD_OFFSET(rt->dma_addr, siu_stream->cur_period, siu_stream->period_bytes); - virt = PERIOD_OFFSET(rt->dma_area, - siu_stream->cur_period, - siu_stream->period_bytes); count = siu_stream->period_bytes;
/* DMA transfer start */
Hi Pierre-Louis
Thank you for your patches.
No functional changes except for patch 4 where a missing error check was added for consistency.
Pierre-Louis Bossart (8): ASoC: sh: dma-sh7760: remove unused variable ASoC: sh: rcar: align function prototypes ASoC: sh: rcar: simplify return ASoC: sh: rcar: core: rename shadowing variables ASoC: sh: rcar: ctu: add missing error check ASoC: sh: rcar: ssi: remove redundant assignment ASoC: sh: siu_pcm: remove useless assignment ASoC: sh: siu_pcm: remove unused variable
Except [4/8] patch,
Acked-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Thank you for your help !!
Best regards --- Kuninori Morimoto
On Fri, 19 Feb 2021 17:16:27 -0600, Pierre-Louis Bossart wrote:
No functional changes except for patch 4 where a missing error check was added for consistency.
Pierre-Louis Bossart (8): ASoC: sh: dma-sh7760: remove unused variable ASoC: sh: rcar: align function prototypes ASoC: sh: rcar: simplify return ASoC: sh: rcar: core: rename shadowing variables ASoC: sh: rcar: ctu: add missing error check ASoC: sh: rcar: ssi: remove redundant assignment ASoC: sh: siu_pcm: remove useless assignment ASoC: sh: siu_pcm: remove unused variable
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] ASoC: sh: dma-sh7760: remove unused variable commit: 2497d156c297992ef1254fda2277ce055f48db64 [2/8] ASoC: sh: rcar: align function prototypes commit: 8644cbf296de7440f8d53d333da89f79d3258d25 [3/8] ASoC: sh: rcar: simplify return commit: d15737e24a962941bae0373b8a89173e2451e7c9 [5/8] ASoC: sh: rcar: ctu: add missing error check commit: a029ad994d24c92228b4460cc374846170720a05 [6/8] ASoC: sh: rcar: ssi: remove redundant assignment commit: 0711cb41ce02ae8994e4f75551545b114e8922d6 [7/8] ASoC: sh: siu_pcm: remove useless assignment commit: 075bfe61c88a267755bf4cc54af19cab3141f23f [8/8] ASoC: sh: siu_pcm: remove unused variable commit: 69011a3193be54b04b3cfd652c484e6b77cf59b0
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Kuninori Morimoto
-
Mark Brown
-
Pierre-Louis Bossart