[PATCH 0/7] ASoC: soc-core: 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-core.
Kuninori Morimoto (7): ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name() ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name() ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format() ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component() ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls() ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets() ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing()
sound/soc/soc-core.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:1721:33: style: The scope of the variable 'product_version' can be reduced. [variableScope] const char *vendor, *product, *product_version, *board; ^ Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 583f2381cfc8..305b444c507a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1718,7 +1718,7 @@ static void append_dmi_string(struct snd_soc_card *card, const char *str) */ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) { - const char *vendor, *product, *product_version, *board; + const char *vendor, *product, *board;
if (card->long_name) return 0; /* long name already set by driver or from DMI */ @@ -1738,13 +1738,14 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
product = dmi_get_system_info(DMI_PRODUCT_NAME); if (product && is_dmi_valid(product)) { + const char *product_version = dmi_get_system_info(DMI_PRODUCT_VERSION); + append_dmi_string(card, product);
/* * some vendors like Lenovo may only put a self-explanatory * name in the product version field */ - product_version = dmi_get_system_info(DMI_PRODUCT_VERSION); if (product_version && is_dmi_valid(product_version)) append_dmi_string(card, product_version); }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:3203:22: style: The scope of the variable 'component_of_node' can be reduced. [variableScope] struct device_node *component_of_node; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 305b444c507a..6889380a98fc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3201,12 +3201,11 @@ int snd_soc_get_dai_name(const struct of_phandle_args *args, const char **dai_name) { struct snd_soc_component *pos; - struct device_node *component_of_node; int ret = -EPROBE_DEFER;
mutex_lock(&client_mutex); for_each_component(pos) { - component_of_node = soc_component_to_node(pos); + struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != args->np) continue;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:3056:11: style: The scope of the variable 'i' can be reduced. [variableScope] int ret, i; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6889380a98fc..d4e3a6c5b5bb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3054,7 +3054,7 @@ EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_from_bitmap); unsigned int snd_soc_daifmt_parse_format(struct device_node *np, const char *prefix) { - int ret, i; + int ret; char prop[128]; unsigned int format = 0; int bit, frame; @@ -3088,6 +3088,8 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np, ret = of_property_read_string(np, prop, &str); } if (ret == 0) { + int i; + for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) { if (strcmp(str, of_fmt_table[i].name) == 0) { format |= of_fmt_table[i].val;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:2719:28: style: The scope of the variable 'component' can be reduced. [variableScope] struct snd_soc_component *component; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d4e3a6c5b5bb..e8fc6e06efdb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2717,11 +2717,10 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver); */ void snd_soc_unregister_component(struct device *dev) { - struct snd_soc_component *component; - mutex_lock(&client_mutex); while (1) { - component = snd_soc_lookup_component_nolocked(dev, NULL); + struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, NULL); + if (!component) break;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:2239:6: style: The scope of the variable 'err' can be reduced. [variableScope] int err, i; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e8fc6e06efdb..34182e530877 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2237,13 +2237,12 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev, const struct snd_kcontrol_new *controls, int num_controls, const char *prefix, void *data) { - int err, i; + int i;
for (i = 0; i < num_controls; i++) { const struct snd_kcontrol_new *control = &controls[i]; - - err = snd_ctl_add(card, snd_soc_cnew(control, data, - control->name, prefix)); + int err = snd_ctl_add(card, snd_soc_cnew(control, data, + control->name, prefix)); if (err < 0) { dev_err(dev, "ASoC: Failed to add %s: %d\n", control->name, err);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:2777:25: style: The scope of the variable 'ret' can be reduced. [variableScope] int i, j, num_widgets, ret; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 34182e530877..e7d1bc9e31bb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2773,7 +2773,7 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, struct device_node *np = card->dev->of_node; struct snd_soc_dapm_widget *widgets; const char *template, *wname; - int i, j, num_widgets, ret; + int i, j, num_widgets;
num_widgets = of_property_count_strings(np, propname); if (num_widgets < 0) { @@ -2803,8 +2803,8 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, }
for (i = 0; i < num_widgets; i++) { - ret = of_property_read_string_index(np, propname, - 2 * i, &template); + int ret = of_property_read_string_index(np, propname, + 2 * i, &template); if (ret) { dev_err(card->dev, "ASoC: Property '%s' index %d read error:%d\n",
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-core.c:2931: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-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e7d1bc9e31bb..c830e96afba2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2927,7 +2927,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, struct device_node *np = card->dev->of_node; int num_routes; struct snd_soc_dapm_route *routes; - int i, ret; + int i;
num_routes = of_property_count_strings(np, propname); if (num_routes < 0 || num_routes & 1) { @@ -2947,8 +2947,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, }
for (i = 0; i < num_routes; i++) { - ret = of_property_read_string_index(np, propname, - 2 * i, &routes[i].sink); + int ret = of_property_read_string_index(np, propname, + 2 * i, &routes[i].sink); if (ret) { dev_err(card->dev, "ASoC: Property '%s' index %d could not be read: %d\n",
On 29 Jul 2021 10:15:13 +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-core.
Kuninori Morimoto (7): ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name() ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name() ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format() ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component() ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls() ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets() ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing()
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name() commit: cdb76568b09db0ba1aa47f4e55501024342c9dfc [2/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name() commit: bce00560a28e0f62b0250652b611365f363c712b [3/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format() commit: 5ad76775a522f728d89687523accb061f3ffb1f6 [4/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component() commit: 5600f3d5ac53304b5068f55c69afa2b8b2380b2b [5/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls() commit: eaf2469c340b854f5c19339d613234ce2c774a38 [6/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets() commit: 99c68653a56528ce66edf3d87bc050eee2ce0aee [7/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing() commit: 51a3dd58424e7312e70445fcb4bca5924640af2c
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