From: Mark Brown <broonie@kernel.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org, f.suligoi@asem.it,
kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH] ASoC: fsi: Add check for clk_enable
Date: Tue, 1 Mar 2022 12:44:12 +0000 [thread overview]
Message-ID: <Yh4VHFviMI/LbjVe@sirena.org.uk> (raw)
In-Reply-To: <20220301073949.3678707-1-jiasheng@iscas.ac.cn>
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
On Tue, Mar 01, 2022 at 03:39:49PM +0800, Jiasheng Jiang wrote:
> As the potential failure of the clk_enable(),
> it should be better to check it and return error
> if fails.
> - clk_enable(clock->xck);
> - clk_enable(clock->ick);
> - clk_enable(clock->div);
> + ret = clk_enable(clock->xck);
> + if (ret)
> + goto err;
> + ret = clk_enable(clock->ick);
> + if (ret)
> + goto err;
> + ret = clk_enable(clock->div);
> + if (ret)
> + goto err;
>
> clock->count++;
> }
>
> return ret;
> +
> +err:
> + clk_disable(clock->xck);
> + clk_disable(clock->ick);
> + clk_disable(clock->div);
You need separate labels for each enable so that we don't end up
disabling clocks we didn't enable, that would also be a bug.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2022-03-01 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 7:39 Jiasheng Jiang
2022-03-01 12:44 ` Mark Brown [this message]
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=Yh4VHFviMI/LbjVe@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=f.suligoi@asem.it \
--cc=jiasheng@iscas.ac.cn \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=perex@perex.cz \
--cc=songliubraving@fb.com \
--cc=tiwai@suse.com \
--cc=yhs@fb.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
all inboxes | Powered by JetHome®