Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: 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>
Link: https://patch.msgid.link/SE1P216MB2287F4D575CFBDC9755E896BFD6A2@SE1P216MB2287.KORP216.PROD.OUTLOOK.COM
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ingyu Jang and committed by
Mark Brown
23fa0b04 64207f80

+12 -3
+12 -3
sound/soc/uniphier/aio-core.c
··· 921 921 { 922 922 struct regmap *r = sub->aio->chip->regmap; 923 923 u32 v; 924 + int ret; 924 925 925 926 if (sub->swm->dir != PORT_DIR_OUTPUT) 926 927 return 0; 927 928 928 - regmap_write(r, OPORTMXSRC1CTR(sub->swm->oport.map), 929 + ret = regmap_write(r, OPORTMXSRC1CTR(sub->swm->oport.map), 929 930 OPORTMXSRC1CTR_THMODE_SRC | 930 931 OPORTMXSRC1CTR_SRCPATH_CALC | 931 932 OPORTMXSRC1CTR_SYNC_ASYNC | 932 933 OPORTMXSRC1CTR_FSIIPSEL_INNER | 933 934 OPORTMXSRC1CTR_FSISEL_ACLK); 935 + if (ret) 936 + return ret; 934 937 935 938 switch (params_rate(params)) { 936 939 default: ··· 954 951 break; 955 952 } 956 953 957 - regmap_write(r, OPORTMXRATE_I(sub->swm->oport.map), 954 + 955 + ret = regmap_write(r, OPORTMXRATE_I(sub->swm->oport.map), 958 956 v | OPORTMXRATE_I_ACLKSRC_APLL | 959 957 OPORTMXRATE_I_LRCKSTP_STOP); 960 - regmap_update_bits(r, OPORTMXRATE_I(sub->swm->oport.map), 958 + if (ret) 959 + return ret; 960 + 961 + ret = regmap_update_bits(r, OPORTMXRATE_I(sub->swm->oport.map), 961 962 OPORTMXRATE_I_LRCKSTP_MASK, 962 963 OPORTMXRATE_I_LRCKSTP_START); 964 + if (ret) 965 + return ret; 963 966 964 967 return 0; 965 968 }