[PATCH 0/5] ASoC: soc-topology: cleanup cppcheck warning
Hi Mark
Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer discussion. Thus I want to post more easy patch first, and reduce my local patches.
These are cppcheck warning cleanup patches for soc-topology.
Kuninori Morimoto (5): ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dai_elems_load() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dapm_widget_elems_load() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_kcontrol_elems_load() ASoC: soc-topology: cleanup cppcheck warning at snd_soc_find_dai_link()
sound/soc/soc-topology.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-topology.c:2576:27: style: The scope of the variable 'hdr' can be reduced. [variableScope] struct snd_soc_tplg_hdr *hdr; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0a24d0d409d2..9aa7c9c4768b 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2572,13 +2572,13 @@ static int soc_tplg_load_header(struct soc_tplg *tplg, /* process the topology file headers */ static int soc_tplg_process_headers(struct soc_tplg *tplg) { - struct snd_soc_tplg_hdr *hdr; int ret;
tplg->pass = SOC_TPLG_PASS_START;
/* process the header types from start to end */ while (tplg->pass <= SOC_TPLG_PASS_END) { + struct snd_soc_tplg_hdr *hdr;
tplg->hdr_pos = tplg->fw->data; hdr = (struct snd_soc_tplg_hdr *)tplg->hdr_pos;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-topology.c:2350:27: style: The scope of the variable 'dai' can be reduced. [variableScope] struct snd_soc_tplg_dai *dai; ^ sound/soc/soc-topology.c:2352:9: style: The scope of the variable 'ret' can be reduced. [variableScope] int i, ret; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 9aa7c9c4768b..359c6ac22153 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2346,15 +2346,16 @@ static int soc_tplg_dai_config(struct soc_tplg *tplg, static int soc_tplg_dai_elems_load(struct soc_tplg *tplg, struct snd_soc_tplg_hdr *hdr) { - struct snd_soc_tplg_dai *dai; int count; - int i, ret; + int i;
count = le32_to_cpu(hdr->count);
/* config the existing BE DAIs */ for (i = 0; i < count; i++) { - dai = (struct snd_soc_tplg_dai *)tplg->pos; + struct snd_soc_tplg_dai *dai = (struct snd_soc_tplg_dai *)tplg->pos; + int ret; + if (le32_to_cpu(dai->size) != sizeof(*dai)) { dev_err(tplg->dev, "ASoC: invalid physical DAI size\n"); return -EINVAL;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-topology.c:1599:35: style: The scope of the variable 'widget' can be reduced. [variableScope] struct snd_soc_tplg_dapm_widget *widget; ^ sound/soc/soc-topology.c:1600:6: style: The scope of the variable 'ret' can be reduced. [variableScope] int ret, count, i; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 359c6ac22153..98e08afd8eb9 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1583,15 +1583,16 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, static int soc_tplg_dapm_widget_elems_load(struct soc_tplg *tplg, struct snd_soc_tplg_hdr *hdr) { - struct snd_soc_tplg_dapm_widget *widget; - int ret, count, i; + int count, i;
count = le32_to_cpu(hdr->count);
dev_dbg(tplg->dev, "ASoC: adding %d DAPM widgets\n", count);
for (i = 0; i < count; i++) { - widget = (struct snd_soc_tplg_dapm_widget *) tplg->pos; + struct snd_soc_tplg_dapm_widget *widget = (struct snd_soc_tplg_dapm_widget *) tplg->pos; + int ret; + if (le32_to_cpu(widget->size) != sizeof(*widget)) { dev_err(tplg->dev, "ASoC: invalid widget size\n"); return -EINVAL;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-topology.c:1038:31: style: The scope of the variable 'control_hdr' can be reduced. [variableScope] struct snd_soc_tplg_ctl_hdr *control_hdr; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 98e08afd8eb9..a052dfe5efb6 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1035,7 +1035,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, struct snd_soc_tplg_hdr *hdr) { - struct snd_soc_tplg_ctl_hdr *control_hdr; int ret; int i;
@@ -1043,8 +1042,7 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, soc_tplg_get_offset(tplg));
for (i = 0; i < le32_to_cpu(hdr->count); i++) { - - control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos; + struct snd_soc_tplg_ctl_hdr *control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
if (le32_to_cpu(control_hdr->size) != sizeof(*control_hdr)) { dev_err(tplg->dev, "ASoC: invalid control size\n");
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-topology.c:2129:27: style: The scope of the variable 'link' can be reduced. [variableScope] struct snd_soc_dai_link *link; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index a052dfe5efb6..f6e5ac3e0314 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2124,10 +2124,9 @@ static struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, const char *stream_name) { struct snd_soc_pcm_runtime *rtd; - struct snd_soc_dai_link *link;
for_each_card_rtds(card, rtd) { - link = rtd->dai_link; + struct snd_soc_dai_link *link = rtd->dai_link;
if (link->id != id) continue;
On 02 Aug 2021 15:00:09 +0900, Kuninori Morimoto wrote:
Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer discussion. Thus I want to post more easy patch first, and reduce my local patches.
These are cppcheck warning cleanup patches for soc-topology.
Kuninori Morimoto (5): ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dai_elems_load() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dapm_widget_elems_load() ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_kcontrol_elems_load() ASoC: soc-topology: cleanup cppcheck warning at snd_soc_find_dai_link()
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers() commit: f79e4b2a38eda4e365f765d363f47cf0c2183ab4 [2/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dai_elems_load() commit: 65a4cfdd6f2bc04b0c3d3607c48ceeac999c9424 [3/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dapm_widget_elems_load() commit: e9aa139f95f5995d7010f46c285f5b9a19695b2d [4/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_kcontrol_elems_load() commit: ea8f6b29b4a5676ca4b67b571a63ebabec245fd2 [5/5] ASoC: soc-topology: cleanup cppcheck warning at snd_soc_find_dai_link() commit: b81e8efa245af00e152a485297c611fe84a514a9
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 (2)
-
Kuninori Morimoto
-
Mark Brown