diff mbox series

ASoC: Intel: avs: Add error handling in avs_tplg_parse_initial_configs

Message ID 20241122063257.4419-1-zhujun2@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series ASoC: Intel: avs: Add error handling in avs_tplg_parse_initial_configs | expand

Commit Message

Zhu Jun Nov. 22, 2024, 6:32 a.m. UTC
Introduce error handling in avs_tplg_parse_initial_configs to ensure that
the function returns immediately if parse_dictionary_entries fails.

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 sound/soc/intel/avs/topology.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Markus Elfring Nov. 22, 2024, 11:05 a.m. UTC | #1
> Introduce error handling in avs_tplg_parse_initial_configs to ensure that
> the function returns immediately if parse_dictionary_entries fails.

* I propose to append parentheses to function names.

* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12#n145


Regards,
Markus
Cezary Rojewski Nov. 22, 2024, 11:10 a.m. UTC | #2
On 2024-11-22 7:32 AM, Zhu Jun wrote:
> Introduce error handling in avs_tplg_parse_initial_configs to ensure that
> the function returns immediately if parse_dictionary_entries fails.

Nitpick: mention functions with '()' to make them stand out next to 
their struct/field friends, e.g.: avs_tplg_parse_initial_configs().

> 
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
>   sound/soc/intel/avs/topology.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
> index 5cda52702..3f76581af 100644
> --- a/sound/soc/intel/avs/topology.c
> +++ b/sound/soc/intel/avs/topology.c
> @@ -1500,7 +1500,6 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
>   				      AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32);
>   	if (ret)
>   		return ret;
> -

Spurious whitespace change. Please remove.

>   	block_size -= le32_to_cpu(tuples->size);
>   	/* With header parsed, move on to parsing entries. */
>   	tuples = avs_tplg_vendor_array_next(tuples);
> @@ -1522,6 +1521,8 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
>   					       AVS_TKN_MOD_INIT_CONFIG_ID_U32,
>   					       mod_init_config_parsers,
>   					       ARRAY_SIZE(mod_init_config_parsers));
> +		if (ret)
> +			return ret;
>   

Agree, outcome of parse_dictionary_entries() shall be verified.

>   		block_size -= esize;
>   

Jun, in future, please remember to add Mark Brown to the list, he's the 
maintainer who governs the ASoC subsystem. If you are unsure who 
maintains what, ./scripts/get_maintainer.pl should help with that.
diff mbox series

Patch

diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
index 5cda52702..3f76581af 100644
--- a/sound/soc/intel/avs/topology.c
+++ b/sound/soc/intel/avs/topology.c
@@ -1500,7 +1500,6 @@  static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
 				      AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32);
 	if (ret)
 		return ret;
-
 	block_size -= le32_to_cpu(tuples->size);
 	/* With header parsed, move on to parsing entries. */
 	tuples = avs_tplg_vendor_array_next(tuples);
@@ -1522,6 +1521,8 @@  static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
 					       AVS_TKN_MOD_INIT_CONFIG_ID_U32,
 					       mod_init_config_parsers,
 					       ARRAY_SIZE(mod_init_config_parsers));
+		if (ret)
+			return ret;
 
 		block_size -= esize;