[PATCH 0/5] ASoC: remove more cppcheck warnings
I missed those warnings in the previous rounds, they are mostly trivial and shouldn't change the behavior.
Pierre-Louis Bossart (5): ASoC: soc-acpi: remove useless initialization ASoC: soc-core: fix signed/unsigned issue ASoC: soc-core: fix always-false condition ASoC: codecs: lpass-rx-macro: remove useless return ASoC: codecs: rt5682: clarify expression
sound/soc/codecs/lpass-rx-macro.c | 2 -- sound/soc/codecs/rt5682.c | 2 +- sound/soc/soc-acpi.c | 2 +- sound/soc/soc-core.c | 7 +------ 4 files changed, 3 insertions(+), 10 deletions(-)
cppcheck warning:
sound/soc/soc-acpi.c:37:21: style: Variable 'status' is assigned a value that is never used. [unreadVariable] acpi_status status = AE_OK; ^ Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Daniel Baluta daniel.baluta@gmail.com Reviewed-by: Guennadi Liakhovetski guennadi.liakhovetski@linux.intel.com --- sound/soc/soc-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c index 444ce0602f76..395229bf5c51 100644 --- a/sound/soc/soc-acpi.c +++ b/sound/soc/soc-acpi.c @@ -34,7 +34,7 @@ static acpi_status snd_soc_acpi_find_package(acpi_handle handle, u32 level, void *context, void **ret) { struct acpi_device *adev; - acpi_status status = AE_OK; + acpi_status status; struct snd_soc_acpi_package_context *pkg_ctx = context;
pkg_ctx->data_valid = false;
cppcheck warning:
sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int] } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) { ^ sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int] } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) { ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Daniel Baluta daniel.baluta@gmail.com Reviewed-by: Guennadi Liakhovetski guennadi.liakhovetski@linux.intel.com --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 236e075b9e57..aee91bde9fb8 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2215,7 +2215,7 @@ static char *fmt_single_name(struct device *dev, int *id) { const char *devname = dev_name(dev); char *found, *name; - int id1, id2; + unsigned int id1, id2;
if (devname == NULL) return NULL;
cppcheck warning:
sound/soc/soc-core.c:2784:6: style: Condition '!num_routes' is always false [knownConditionTrueFalse] if (!num_routes) { ^ sound/soc/soc-core.c:2777:17: note: Assuming that condition 'num_routes<0' is not redundant if (num_routes < 0 || num_routes & 1) { ^ sound/soc/soc-core.c:2783:2: note: Compound assignment '/=', assigned value is 0 num_routes /= 2; ^ sound/soc/soc-core.c:2784:6: note: Condition '!num_routes' is always false if (!num_routes) { ^
The documentation for of_property_count_string reads
" * Returns the number of strings on * success, -EINVAL if the property does not exist, -ENODATA if property * does not have a value, and -EILSEQ if the string is not null-terminated * within the length of the property data. "
Since the case for num_routes == 0 is not possible, let's remove this test.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Daniel Baluta daniel.baluta@gmail.com Reviewed-by: Guennadi Liakhovetski guennadi.liakhovetski@linux.intel.com --- sound/soc/soc-core.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index aee91bde9fb8..3a4ae52e5280 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2781,11 +2781,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, return -EINVAL; } num_routes /= 2; - if (!num_routes) { - dev_err(card->dev, "ASoC: Property '%s's length is zero\n", - propname); - return -EINVAL; - }
routes = devm_kcalloc(card->dev, num_routes, sizeof(*routes), GFP_KERNEL);
cppcheck warning:
sound/soc/codecs/lpass-rx-macro.c:1626:9: warning: Identical condition and return expression 'ret', return value is always 0 [identicalConditionAfterEarlyExit] return ret; ^ sound/soc/codecs/lpass-rx-macro.c:1623:6: note: If condition 'ret' is true, the function will return/exit if (ret) ^ sound/soc/codecs/lpass-rx-macro.c:1626:9: note: Returning identical expression 'ret' return ret; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Daniel Baluta daniel.baluta@gmail.com Reviewed-by: Guennadi Liakhovetski guennadi.liakhovetski@linux.intel.com --- sound/soc/codecs/lpass-rx-macro.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 8e6a47f152ad..b0ebfc8d180c 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -1620,8 +1620,6 @@ static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai, return ret;
ret = rx_macro_set_mix_interpolator_rate(dai, rate_val, sample_rate); - if (ret) - return ret;
return ret; }
cppcheck warning:
sound/soc/codecs/rt5682.c:2404:42: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST)); ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Daniel Baluta daniel.baluta@gmail.com Reviewed-by: Guennadi Liakhovetski guennadi.liakhovetski@linux.intel.com --- sound/soc/codecs/rt5682.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index 0e2a10ed11da..a5aacfe01a0d 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2401,7 +2401,7 @@ static int rt5682_set_component_pll(struct snd_soc_component *component, (pll_code.n_code << RT5682_PLL_N_SFT) | pll_code.k_code); snd_soc_component_write(component, RT5682_PLL_CTRL_2, ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT) | - (pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST)); + ((pll_code.m_bp << RT5682_PLL_M_BP_SFT) | RT5682_PLL_RST)); }
rt5682->pll_in[pll_id] = freq_in;
On Fri, 16 Apr 2021 14:11:39 -0500, Pierre-Louis Bossart wrote:
I missed those warnings in the previous rounds, they are mostly trivial and shouldn't change the behavior.
Pierre-Louis Bossart (5): ASoC: soc-acpi: remove useless initialization ASoC: soc-core: fix signed/unsigned issue ASoC: soc-core: fix always-false condition ASoC: codecs: lpass-rx-macro: remove useless return ASoC: codecs: rt5682: clarify expression
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/5] ASoC: soc-acpi: remove useless initialization commit: 59ce3233a538fc21c5c59ff38cafd784cbcd6de0 [2/5] ASoC: soc-core: fix signed/unsigned issue commit: d3b47a888f0bc66a8590941cfa57ba015b288040 [3/5] ASoC: soc-core: fix always-false condition commit: e2290daefef3afa08135a0a65d4f0ce7fe23d5c0 [4/5] ASoC: codecs: lpass-rx-macro: remove useless return commit: 36924a12c32021a098fec621fb5ea707a72cd5b5 [5/5] ASoC: codecs: rt5682: clarify expression commit: 9726db36ed83670be93d053e05e150308e3ce743
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)
-
Mark Brown
-
Pierre-Louis Bossart