public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: jz4740-i2s: add missed checks for clk_get()
Date: Thu, 03 Dec 2020 16:38:24 +0000	[thread overview]
Message-ID: <0KVRKQ.500J00DY5DNR@crapouillou.net> (raw)
In-Reply-To: <20201203144227.418194-1-hslester96@gmail.com>

Hi,

Le jeu. 3 déc. 2020 à 22:42, Chuhong Yuan <hslester96@gmail.com> a 
écrit :
> jz4740_i2s_set_sysclk() does not check the return values of clk_get(),
> while the file dereferences the pointers in clk_put().
> Add the missed checks to fix it.
> 
> Fixes: 11bd3dd1b7c2 ("ASoC: Add JZ4740 ASoC support")
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Acked-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  sound/soc/jz4740/jz4740-i2s.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/soc/jz4740/jz4740-i2s.c 
> b/sound/soc/jz4740/jz4740-i2s.c
> index c7bd20104b20..0793e284d0e7 100644
> --- a/sound/soc/jz4740/jz4740-i2s.c
> +++ b/sound/soc/jz4740/jz4740-i2s.c
> @@ -312,10 +312,14 @@ static int jz4740_i2s_set_sysclk(struct 
> snd_soc_dai *dai, int clk_id,
>  	switch (clk_id) {
>  	case JZ4740_I2S_CLKSRC_EXT:
>  		parent = clk_get(NULL, "ext");
> +		if (IS_ERR(parent))
> +			return PTR_ERR(parent);
>  		clk_set_parent(i2s->clk_i2s, parent);
>  		break;
>  	case JZ4740_I2S_CLKSRC_PLL:
>  		parent = clk_get(NULL, "pll half");
> +		if (IS_ERR(parent))
> +			return PTR_ERR(parent);
>  		clk_set_parent(i2s->clk_i2s, parent);
>  		ret = clk_set_rate(i2s->clk_i2s, freq);
>  		break;
> --
> 2.26.2
> 



  reply	other threads:[~2020-12-03 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 14:42 [PATCH] ASoC: jz4740-i2s: add missed checks for clk_get() Chuhong Yuan
2020-12-03 16:38 ` Paul Cercueil [this message]
2020-12-04 23:30 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0KVRKQ.500J00DY5DNR@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hslester96@gmail.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox