From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: bcm2835-i2s: Check clock enable return value
Date: Thu, 03 Dec 2026 06:51:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-247250@kernel.org> (raw)
In-Reply-To: <20261203063435.13517-3-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ASoC: bcm2835-i2s: bcm2835_i2s_clear_fifos() drops clock
enable errors
- [Low] ASoC: bcm2835-i2s: missing Fixes trailer for commit 517e7a1537ae
--
commit f71f2eb66ebb99e713f0cc2faab79f0556d20a07
Author: bui duc phuc <phucduc.bui@gmail.com>
> ASoC: bcm2835-i2s: Check clock enable return value
>
> bcm2835_i2s_start_clock() ignores the return value of
> clk_prepare_enable() and marks the clock as prepared even on failure,
> so bcm2835_i2s_stop_clock() later disables a clock that was never
> enabled.
>
> Return the error and only set clk_prepared on success. Propagate it
> from .hw_params, and skip clearing the FIFOs in
> bcm2835_i2s_clear_fifos(), which cannot be done without the clock.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
[Severity: Low]
This fixes a clock-imbalance bug introduced by commit 517e7a1537ae
("ASoC: bcm2835: move to use the clock framework"). Should this
include:
Fixes: 517e7a1537ae ("ASoC: bcm2835: move to use the clock framework")
> diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
> index 68be1ded6f935..f367ca070e3a2 100644
> --- a/sound/soc/bcm/bcm2835-i2s.c
> +++ b/sound/soc/bcm/bcm2835-i2s.c
[ ... ]
> @@ -173,8 +181,11 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev,
>
> /* Start clock if not running */
> clk_was_prepared = dev->clk_prepared;
> - if (!clk_was_prepared)
> - bcm2835_i2s_start_clock(dev);
> + if (!clk_was_prepared) {
> + ret = bcm2835_i2s_start_clock(dev);
> + if (ret)
> + return;
> + }
[Severity: Medium]
Does discarding ret here let bcm2835_i2s_prepare() return 0 when the
clock fails to enable, leaving the stream prepared with stale FIFO data
and no active clock?
Even with symmetric_sample_bits set, dev->clk_prepared can be false in
bcm2835_i2s_prepare(). ALSA symmetry checks physical width (32 bits for
both S24_LE and S32_LE), whereas bcm2835_i2s_hw_params() derives
bclk_rate from logical width via snd_soc_params_to_bclk().
If an S24_LE stream stops or xruns with a non-empty FIFO, a full-duplex
S32_LE stream in bcm2835_i2s_hw_params() stops the clock and can fail to
restart it. When the first stream then calls bcm2835_i2s_prepare(), the
clock error is dropped and bcm2835_i2s_prepare() returns 0.
Both callers (bcm2835_i2s_hw_params() and bcm2835_i2s_prepare()) already
return int, so bcm2835_i2s_clear_fifos() could return int and propagate
the error.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203063435.13517-1-phucduc.bui@gmail.com?part=2
next prev parent reply other threads:[~2026-12-03 6:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 6:34 [PATCH 0/2] ASoC: bcm2835-i2s: Fix clock handling phucduc.bui
2026-12-03 6:34 ` [PATCH 1/2] ASoC: bcm2835-i2s: Remove redundant clock start/stop in trigger path phucduc.bui
2026-12-03 6:34 ` [PATCH 2/2] ASoC: bcm2835-i2s: Check clock enable return value phucduc.bui
2026-12-03 6:51 ` sashiko-bot [this message]
2026-12-03 7:15 ` Bui Duc Phuc
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=sashiko-outbox-247250@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=phucduc.bui@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 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.