From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Bui Duc Phuc <phucduc.bui@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Cyril Chao <Cyril.Chao@mediatek.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Dan Carpenter <error27@gmail.com>,
cassiogabrielcontato@gmail.com, linux-sound@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 02/13] ASoC: mediatek: mt8189: Propagate APLL enable errors
Date: Tue, 15 Sep 2026 10:08:37 +0200 [thread overview]
Message-ID: <936fda6d-8e9e-41f1-b988-b2a4dcb4004d@collabora.com> (raw)
In-Reply-To: <CAABR9nEB16gANTVf-B+sud0+11XhjCjqiCRY3hP_rnaFstB0tw@mail.gmail.com>
On 9/15/26 08:55, Bui Duc Phuc wrote:
> Hi Mark , Angelo
>
> Thanks both for the review.
>
>>
>>>> Though practically speaking the error
>>>> handling ends up being the same as if they couldn't fail since if
>>>> something goes wrong it's generally catastrophic stuff like locking the
>>>> core up completely so the end result is the same.
>>
>>> That was also an implicit point (that should've been explicit from me): if anything
>>> goes horribly wrong here, it means that it already went horribly wrong "some
>>> function calls ago", and the platform likely already locked up as you suggested.
>>
>>> In any case, I'm not against doing error checking, it's just about not doing it
>>> when it's really useless (I'm sure you understand my reasons), and I believe this
>>> specific case is one of those.
>>
>>> That said, should you prefer having error checks in such places... it's not a
>>> performance path, so I don't really have strong opinions really.
>>
>> Yeah, I think it's fine and sensible to skip the error checks in cases
>> where we can't really do anything constructive about the error.
>
> As far as I understand it, regmap_update_bits() doesn't go straight to MMIO.
> It first passes through the regmap core, which has checks independent of
> the underlying bus:
>
> https://elixir.bootlin.com/linux/v7.3-rc2/source/drivers/base/regmap/regmap.c#L2834
>
> ----------------------------------------------
> if (map->cache_only)
> return -EBUSY;
>
> if (!regmap_readable(map, reg))
> return -EIO;
> ----------------------------------------------
>
> So, in my understanding, checking ret here isn't just unnecessary
> defensive programming
> for an MMIO write, it guards an assumption about PM/cache ordering, namely that
> the regmap is already out of cache_only mode by the time this runs.
You have reasons, of course, but have a wider view and check the full picture:
apll{1,2}_enable() is called only by mtk_apll_event(), which is a DAPM supply.
That call can only happen if the device is not in suspended state, so can happen
only after a call to
regcache_cache_only(afe->regmap, false);
regcache_sync(afe->regmap);
is done in mt8189_afe_runtime_resume().
> If that assumption were ever violated by a bug elsewhere (
> a PM race,
That would have worst consequences, and your system won't be saved by this error
check because it would crash way before reaching that...
> wrong resume ordering,
If limited to ASoC, that would break most (if not all) sound drivers, as that'd
happen at the API level, and would get fixed immediately since that'd affect way
too many platforms and architectures.
> a register missing from readable_reg, etc.),
..and that would be a driver bug, which is not the case here: the error check
though would be useful during development where you definitely want to paranoidly
check for literally everything, even "useless" things... but this driver definitely
is not in development stage, is it? :-)
> this is where it would
> get caught and reported,
...but then you still wouldn't be able to do anything about it during runtime, as
there would be no way to handle this and fix it: the driver would still act in a
broken manner.
Cheers,
Angelo
> rather than the driver silently assuming the enable succeeded when it didn't.
>
> Best regards,
> Phuc
next prev parent reply other threads:[~2026-09-15 8:08 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 7:28 [PATCH v2 00/13] ASoC: mediatek: mt8189: Improve error handling phucduc.bui
2026-09-14 7:28 ` [PATCH v2 01/13] ASoC: mediatek: mt8189: Return error for missing regmap phucduc.bui
2026-09-14 13:26 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 02/13] ASoC: mediatek: mt8189: Propagate APLL enable errors phucduc.bui
2026-09-14 13:22 ` AngeloGioacchino Del Regno
2026-09-14 13:47 ` Mark Brown
2026-09-14 13:58 ` AngeloGioacchino Del Regno
2026-09-14 14:03 ` Mark Brown
2026-09-15 6:55 ` Bui Duc Phuc
2026-09-15 8:08 ` AngeloGioacchino Del Regno [this message]
2026-09-15 10:40 ` Bui Duc Phuc
2026-09-14 7:28 ` [PATCH v2 03/13] ASoC: mediatek: mt8189: Propagate MCK " phucduc.bui
2026-09-14 7:28 ` [PATCH v2 04/13] ASoC: mediatek: mt8189: Validate MCK ID phucduc.bui
2026-09-14 13:27 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 05/13] ASoC: mediatek: mt8189: Propagate reg_rw clock errors phucduc.bui
2026-09-14 7:28 ` [PATCH v2 06/13] ASoC: mediatek: mt8189: Use dev_err_probe() for " phucduc.bui
2026-09-14 13:26 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 07/13] ASoC: mediatek: mt8189: Propagate runtime resume errors phucduc.bui
2026-09-14 13:26 ` AngeloGioacchino Del Regno
2026-09-15 7:55 ` Bui Duc Phuc
2026-09-15 8:23 ` Bui Duc Phuc
2026-09-15 8:26 ` AngeloGioacchino Del Regno
2026-09-15 10:43 ` Bui Duc Phuc
2026-09-14 7:28 ` [PATCH v2 08/13] ASoC: mediatek: mt8189: Remove redundant error message phucduc.bui
2026-09-14 13:28 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 09/13] ASoC: mediatek: mt8189: Propagate APLL errors phucduc.bui
2026-09-14 7:28 ` [PATCH v2 10/13] ASoC: mediatek: mt8189: Propagate MCLK errors phucduc.bui
2026-09-14 13:28 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 11/13] ASoC: mediatek: mt8189: Validate sysclk frequency phucduc.bui
2026-09-14 13:28 ` AngeloGioacchino Del Regno
2026-09-14 7:28 ` [PATCH v2 12/13] ASoC: mediatek: mt8189: Propagate TDM clock errors phucduc.bui
2026-09-14 7:28 ` [PATCH v2 13/13] ASoC: mediatek: mt8189: Validate TDM MCLK frequency phucduc.bui
2026-09-14 13:29 ` AngeloGioacchino Del Regno
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=936fda6d-8e9e-41f1-b988-b2a4dcb4004d@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=Cyril.Chao@mediatek.com \
--cc=broonie@kernel.org \
--cc=cassiogabrielcontato@gmail.com \
--cc=cezary.rojewski@intel.com \
--cc=error27@gmail.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=phucduc.bui@gmail.com \
--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
all inboxes | Powered by JetHome®