Skip to content

Commit

Permalink
ASoC: rsnd: Add check for rsnd_mod_power_on
Browse files Browse the repository at this point in the history
[ Upstream commit 376be51 ]

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

Fixes: e7d850d ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20220902013030.3691266-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
JiangJias authored and gregkh committed Oct 21, 2022
1 parent c62af46 commit 45c6f06
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion sound/soc/sh/rcar/ctu.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ static int rsnd_ctu_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
rsnd_mod_power_on(mod);
int ret;

ret = rsnd_mod_power_on(mod);
if (ret < 0)
return ret;

rsnd_ctu_activation(mod);

Expand Down
6 changes: 5 additions & 1 deletion sound/soc/sh/rcar/dvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
rsnd_mod_power_on(mod);
int ret;

ret = rsnd_mod_power_on(mod);
if (ret < 0)
return ret;

rsnd_dvc_activation(mod);

Expand Down
6 changes: 5 additions & 1 deletion sound/soc/sh/rcar/mix.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ static int rsnd_mix_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
rsnd_mod_power_on(mod);
int ret;

ret = rsnd_mod_power_on(mod);
if (ret < 0)
return ret;

rsnd_mix_activation(mod);

Expand Down
5 changes: 4 additions & 1 deletion sound/soc/sh/rcar/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,14 @@ static int rsnd_src_init(struct rsnd_mod *mod,
struct rsnd_priv *priv)
{
struct rsnd_src *src = rsnd_mod_to_src(mod);
int ret;

/* reset sync convert_rate */
src->sync.val = 0;

rsnd_mod_power_on(mod);
ret = rsnd_mod_power_on(mod);
if (ret < 0)
return ret;

rsnd_src_activation(mod);

Expand Down
4 changes: 3 additions & 1 deletion sound/soc/sh/rcar/ssi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 45c6f06

Please sign in to comment.