All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rsnd: Add check for rsnd_mod_power_on
@ 2022-09-01  7:11 ` Jiasheng Jiang
  0 siblings, 0 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2022-09-01  7:11 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, kuninori.morimoto.gx
  Cc: alsa-devel, linux-kernel, Jiasheng Jiang

As rsnd_mod_power_on() can return negative numbers,
it should be better to check the return value and
deal with the exception.

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 sound/soc/sh/rcar/ssi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 43c5e27dc5c8..7ade6c5ed96f 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 
 	ssi->usrcnt++;
 
-	rsnd_mod_power_on(mod);
+	ret = rsnd_mod_power_on(mod);
+	if (ret < 0)
+		return ret;
 
 	rsnd_ssi_config_init(mod, io);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ASoC: rsnd: Add check for rsnd_mod_power_on
@ 2022-09-01  7:11 ` Jiasheng Jiang
  0 siblings, 0 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2022-09-01  7:11 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, kuninori.morimoto.gx
  Cc: alsa-devel, Jiasheng Jiang, linux-kernel

As rsnd_mod_power_on() can return negative numbers,
it should be better to check the return value and
deal with the exception.

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 sound/soc/sh/rcar/ssi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 43c5e27dc5c8..7ade6c5ed96f 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 
 	ssi->usrcnt++;
 
-	rsnd_mod_power_on(mod);
+	ret = rsnd_mod_power_on(mod);
+	if (ret < 0)
+		return ret;
 
 	rsnd_ssi_config_init(mod, io);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rsnd: Add check for rsnd_mod_power_on
  2022-09-01  7:11 ` Jiasheng Jiang
@ 2022-09-01 23:02   ` Kuninori Morimoto
  -1 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2022-09-01 23:02 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel


Hi

> As rsnd_mod_power_on() can return negative numbers,
> it should be better to check the return value and
> deal with the exception.
> 
> Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
(snip)
> --- a/sound/soc/sh/rcar/ssi.c
> +++ b/sound/soc/sh/rcar/ssi.c
> @@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
>  
>  	ssi->usrcnt++;
>  
> -	rsnd_mod_power_on(mod);
> +	ret = rsnd_mod_power_on(mod);
> +	if (ret < 0)
> +		return ret;

This looks good to me, but, the code which is using rsnd_mod_power_on()
and not checking the return value is not only ssi.c.

	> grep rsnd_mod_power_on ./sound/soc/sh/rcar/*.c                                                              [~/Mail/tmp]
	sound/soc/sh/rcar/ctu.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/dvc.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/mix.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/src.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/ssi.c:      rsnd_mod_power_on(mod);

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rsnd: Add check for rsnd_mod_power_on
@ 2022-09-01 23:02   ` Kuninori Morimoto
  0 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2022-09-01 23:02 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: alsa-devel, lgirdwood, linux-kernel, tiwai, broonie


Hi

> As rsnd_mod_power_on() can return negative numbers,
> it should be better to check the return value and
> deal with the exception.
> 
> Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
(snip)
> --- a/sound/soc/sh/rcar/ssi.c
> +++ b/sound/soc/sh/rcar/ssi.c
> @@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
>  
>  	ssi->usrcnt++;
>  
> -	rsnd_mod_power_on(mod);
> +	ret = rsnd_mod_power_on(mod);
> +	if (ret < 0)
> +		return ret;

This looks good to me, but, the code which is using rsnd_mod_power_on()
and not checking the return value is not only ssi.c.

	> grep rsnd_mod_power_on ./sound/soc/sh/rcar/*.c                                                              [~/Mail/tmp]
	sound/soc/sh/rcar/ctu.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/dvc.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/mix.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/src.c:      rsnd_mod_power_on(mod);
	sound/soc/sh/rcar/ssi.c:      rsnd_mod_power_on(mod);

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-01 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01  7:11 [PATCH] ASoC: rsnd: Add check for rsnd_mod_power_on Jiasheng Jiang
2022-09-01  7:11 ` Jiasheng Jiang
2022-09-01 23:02 ` Kuninori Morimoto
2022-09-01 23:02   ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.