[PATCH] ASoC: simple-card-utils: fixup simple_util_startup() error handling
It should use "goto" instead of "return"
Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag") Reported-by: kernel test robot lkp@intel.com Reported-by: Dan Carpenter dan.carpenter@linaro.org Closes: https://lore.kernel.org/all/202309141205.ITZeDJxV-lkp@intel.com/ Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- I have mentioned that different point when reply, but Dan's report was correct.
sound/soc/generic/simple-card-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 36ce3a4343f9..348fe6f8a537 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -310,7 +310,7 @@ int simple_util_startup(struct snd_pcm_substream *substream) if (fixed_sysclk % props->mclk_fs) { dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n", fixed_sysclk, props->mclk_fs); - return -EINVAL; + goto codec_err; } ret = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, fixed_rate, fixed_rate);
On Thu, 2023-09-14 at 23:12 +0000, Kuninori Morimoto wrote:
It should use "goto" instead of "return"
Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock- fixed flag") Reported-by: kernel test robot lkp@intel.com Reported-by: Dan Carpenter dan.carpenter@linaro.org Closes: https://urldefense.com/v3/__https://lore.kernel.org/all/202309141205.ITZeDJx... Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
I have mentioned that different point when reply, but Dan's report was correct.
sound/soc/generic/simple-card-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 36ce3a4343f9..348fe6f8a537 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -310,7 +310,7 @@ int simple_util_startup(struct snd_pcm_substream *substream) if (fixed_sysclk % props->mclk_fs) { dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n", fixed_sysclk, props->mclk_fs); - return -EINVAL; + goto codec_err; } ret = snd_pcm_hw_constraint_minmax(substream-
runtime, SNDRV_PCM_HW_PARAM_RATE,
fixed_rate, fixed_rate);
2.25.1
Reviewed-by: Robert Hancock robert.hancock@calian.com
Hi Kuninori,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kuninori-Morimoto/ASoC-simple... base: linus/master patch link: https://lore.kernel.org/r/87zg1opcwt.wl-kuninori.morimoto.gx%40renesas.com patch subject: [PATCH] ASoC: simple-card-utils: fixup simple_util_startup() error handling config: x86_64-randconfig-161-20230915 (https://download.01.org/0day-ci/archive/20230915/202309151840.au9Aa2W4-lkp@i...) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230915/202309151840.au9Aa2W4-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Reported-by: Dan Carpenter dan.carpenter@linaro.org | Closes: https://lore.kernel.org/r/202309151840.au9Aa2W4-lkp@intel.com/
smatch warnings: sound/soc/generic/simple-card-utils.c:313 asoc_simple_startup() warn: missing error code 'ret'
vim +/ret +313 sound/soc/generic/simple-card-utils.c
f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 279 int asoc_simple_startup(struct snd_pcm_substream *substream) f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 280 { 9ae035e289379b Kuninori Morimoto 2020-07-20 281 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 282 struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); fafc05aadd4b6c Kuninori Morimoto 2021-04-12 283 struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num); fafc05aadd4b6c Kuninori Morimoto 2021-04-12 284 struct asoc_simple_dai *dai; 5ca2ab4598179a Robert Hancock 2022-01-20 285 unsigned int fixed_sysclk = 0; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 286 int i1, i2, i; f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 287 int ret; f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 288 fafc05aadd4b6c Kuninori Morimoto 2021-04-12 289 for_each_prop_dai_cpu(props, i1, dai) { fafc05aadd4b6c Kuninori Morimoto 2021-04-12 290 ret = asoc_simple_clk_enable(dai); f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 291 if (ret) fafc05aadd4b6c Kuninori Morimoto 2021-04-12 292 goto cpu_err; 5ca2ab4598179a Robert Hancock 2022-01-20 293 ret = asoc_simple_check_fixed_sysclk(rtd->dev, dai, &fixed_sysclk); 5ca2ab4598179a Robert Hancock 2022-01-20 294 if (ret) 5ca2ab4598179a Robert Hancock 2022-01-20 295 goto cpu_err; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 296 } f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 297 fafc05aadd4b6c Kuninori Morimoto 2021-04-12 298 for_each_prop_dai_codec(props, i2, dai) { fafc05aadd4b6c Kuninori Morimoto 2021-04-12 299 ret = asoc_simple_clk_enable(dai); f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 300 if (ret) fafc05aadd4b6c Kuninori Morimoto 2021-04-12 301 goto codec_err; 5ca2ab4598179a Robert Hancock 2022-01-20 302 ret = asoc_simple_check_fixed_sysclk(rtd->dev, dai, &fixed_sysclk); 5ca2ab4598179a Robert Hancock 2022-01-20 303 if (ret) 5ca2ab4598179a Robert Hancock 2022-01-20 304 goto codec_err; 5ca2ab4598179a Robert Hancock 2022-01-20 305 } 5ca2ab4598179a Robert Hancock 2022-01-20 306 5ca2ab4598179a Robert Hancock 2022-01-20 307 if (fixed_sysclk && props->mclk_fs) { 5ca2ab4598179a Robert Hancock 2022-01-20 308 unsigned int fixed_rate = fixed_sysclk / props->mclk_fs; 5ca2ab4598179a Robert Hancock 2022-01-20 309 5ca2ab4598179a Robert Hancock 2022-01-20 310 if (fixed_sysclk % props->mclk_fs) { 5ca2ab4598179a Robert Hancock 2022-01-20 311 dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n", 5ca2ab4598179a Robert Hancock 2022-01-20 312 fixed_sysclk, props->mclk_fs); 2f7ac863515034 Kuninori Morimoto 2023-09-14 @313 goto codec_err;
error code?
5ca2ab4598179a Robert Hancock 2022-01-20 314 } 5ca2ab4598179a Robert Hancock 2022-01-20 315 ret = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, 5ca2ab4598179a Robert Hancock 2022-01-20 316 fixed_rate, fixed_rate); 635071f5fee315 Robert Hancock 2023-06-01 317 if (ret < 0) 5ca2ab4598179a Robert Hancock 2022-01-20 318 goto codec_err; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 319 } f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 320 fafc05aadd4b6c Kuninori Morimoto 2021-04-12 321 return 0; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 322 fafc05aadd4b6c Kuninori Morimoto 2021-04-12 323 codec_err: fafc05aadd4b6c Kuninori Morimoto 2021-04-12 324 for_each_prop_dai_codec(props, i, dai) { fafc05aadd4b6c Kuninori Morimoto 2021-04-12 325 if (i >= i2) fafc05aadd4b6c Kuninori Morimoto 2021-04-12 326 break; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 327 asoc_simple_clk_disable(dai); fafc05aadd4b6c Kuninori Morimoto 2021-04-12 328 } fafc05aadd4b6c Kuninori Morimoto 2021-04-12 329 cpu_err: fafc05aadd4b6c Kuninori Morimoto 2021-04-12 330 for_each_prop_dai_cpu(props, i, dai) { fafc05aadd4b6c Kuninori Morimoto 2021-04-12 331 if (i >= i1) fafc05aadd4b6c Kuninori Morimoto 2021-04-12 332 break; fafc05aadd4b6c Kuninori Morimoto 2021-04-12 333 asoc_simple_clk_disable(dai); fafc05aadd4b6c Kuninori Morimoto 2021-04-12 334 } f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 335 return ret; f38df5bf0c9cb9 Kuninori Morimoto 2019-03-20 336 }
Hi Dan
5ca2ab4598179a Robert Hancock 2022-01-20 307 if (fixed_sysclk && props->mclk_fs) { 5ca2ab4598179a Robert Hancock 2022-01-20 308 unsigned int fixed_rate = fixed_sysclk / props->mclk_fs; 5ca2ab4598179a Robert Hancock 2022-01-20 309 5ca2ab4598179a Robert Hancock 2022-01-20 310 if (fixed_sysclk % props->mclk_fs) { 5ca2ab4598179a Robert Hancock 2022-01-20 311 dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n", 5ca2ab4598179a Robert Hancock 2022-01-20 312 fixed_sysclk, props->mclk_fs); 2f7ac863515034 Kuninori Morimoto 2023-09-14 @313 goto codec_err;
error code?
Thank you for pointing it. Will fix and post v2 patch.
Thank you for your help !!
Best regards --- Kuninori Morimoto
participants (3)
-
Dan Carpenter
-
Kuninori Morimoto
-
Robert Hancock