[PATCH] sound: soc: uniphier: Handle regmap_write errors in aio_src_set_param()
From 791716bf359b8540c519810848fd1f8006d7c3c5 Mon Sep 17 00:00:00 2001 From: Ingyu Jang ingyujang25@unist.ac.kr Date: Thu, 26 Sep 2024 19:40:04 +0900 Subject: [PATCH] sound: soc: uniphier: Handle regmap_write errors in aio_src_set_param()
The aio_src_set_param() function did not previously check the return values of regmap_write() and regmap_update_bits(). If these functions fail, it could lead to silent failures when configuring the sample rate converter (SRC), causing improper behavior in audio processing without any indication of an error.
This patch modifies aio_src_set_param to check the return values of regmap_write() and regmap_update_bits(). If either function returns an error, the error code is propagated back to the caller to ensure proper error handling. This change aligns with the existing error-handling behavior in functions like uniphier_aio_prepare(), where a failure in a sub-function should result in an immediate return of the error.
Signed-off-by: Ingyu Jang ingyujang25@unist.ac.kr --- sound/soc/uniphier/aio-core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/sound/soc/uniphier/aio-core.c b/sound/soc/uniphier/aio-core.c index 0eba60758134..2c4e8b873253 100644 --- a/sound/soc/uniphier/aio-core.c +++ b/sound/soc/uniphier/aio-core.c @@ -921,16 +921,19 @@ int aio_src_set_param(struct uniphier_aio_sub *sub, { struct regmap *r = sub->aio->chip->regmap; u32 v; + int ret;
if (sub->swm->dir != PORT_DIR_OUTPUT) return 0;
- regmap_write(r, OPORTMXSRC1CTR(sub->swm->oport.map), + ret = regmap_write(r, OPORTMXSRC1CTR(sub->swm->oport.map), OPORTMXSRC1CTR_THMODE_SRC | OPORTMXSRC1CTR_SRCPATH_CALC | OPORTMXSRC1CTR_SYNC_ASYNC | OPORTMXSRC1CTR_FSIIPSEL_INNER | OPORTMXSRC1CTR_FSISEL_ACLK); + if (ret) + return ret;
switch (params_rate(params)) { default: @@ -951,12 +954,18 @@ int aio_src_set_param(struct uniphier_aio_sub *sub, break; }
- regmap_write(r, OPORTMXRATE_I(sub->swm->oport.map), + + ret = regmap_write(r, OPORTMXRATE_I(sub->swm->oport.map), v | OPORTMXRATE_I_ACLKSRC_APLL | OPORTMXRATE_I_LRCKSTP_STOP); - regmap_update_bits(r, OPORTMXRATE_I(sub->swm->oport.map), + if (ret) + return ret; + + ret = regmap_update_bits(r, OPORTMXRATE_I(sub->swm->oport.map), OPORTMXRATE_I_LRCKSTP_MASK, OPORTMXRATE_I_LRCKSTP_START); + if (ret) + return ret;
return 0; }
On Thu, Sep 26, 2024 at 09:15:18PM +0000, (�л�) ���α� (��ǻ�Ͱ��а�) wrote:
From 791716bf359b8540c519810848fd1f8006d7c3c5 Mon Sep 17 00:00:00 2001 From: Ingyu Jang ingyujang25@unist.ac.kr Date: Thu, 26 Sep 2024 19:40:04 +0900 Subject: [PATCH] sound: soc: uniphier: Handle regmap_write errors in aio_src_set_param()
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
On Thu, 26 Sep 2024 21:15:18 +0000, (학생) 장인규 (컴퓨터공학과) wrote:
The aio_src_set_param() function did not previously check the return values of regmap_write() and regmap_update_bits(). If these functions fail, it could lead to silent failures when configuring the sample rate converter (SRC), causing improper behavior in audio processing without any indication of an error.
This patch modifies aio_src_set_param to check the return values of regmap_write() and regmap_update_bits(). If either function returns an error, the error code is propagated back to the caller to ensure proper error handling. This change aligns with the existing error-handling behavior in functions like uniphier_aio_prepare(), where a failure in a sub-function should result in an immediate return of the error.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] sound: soc: uniphier: Handle regmap_write errors in aio_src_set_param() commit: 23fa0b04d3fd4b8277083e9a8abb1a975a05c837
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
(학생) 장인규 (컴퓨터공학과)
-
Mark Brown