]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: uniphier: Handle regmap_write errors in aio_iecout_set_enable()
authorIngyu Jang <ingyujang25@unist.ac.kr>
Tue, 8 Oct 2024 05:11:11 +0000 (14:11 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 22 Oct 2024 23:07:04 +0000 (00:07 +0100)
The aio_oport_set_stream_type() function did not previously check the
return values of regmap_write().
If these functions fail, it could lead to silent failures when
configuring the audio playback port, causing improper behavior in audio
stream output via S/PDIF without any indication of an error.

This patch modifies aio_oport_set_stream_type() to check the return
values of regmap_write().
If regmap_write() fails, the error code is propagated back to the caller
to ensure proper error handling.

Signed-off-by: Ingyu Jang <ingyujang25@unist.ac.kr>
Link: https://patch.msgid.link/SE1P216MB2287962B462AE91B26248D19FD7E2@SE1P216MB2287.KORP216.PROD.OUTLOOK.COM
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/uniphier/aio-core.c

index 2c4e8b87325335cd4ced1046a7143877228bd142..d63def8615eb7291816b398aac8c9317b5f7a71a 100644 (file)
@@ -838,6 +838,7 @@ int aio_oport_set_stream_type(struct uniphier_aio_sub *sub,
 {
        struct regmap *r = sub->aio->chip->regmap;
        u32 repet = 0, pause = OPORTMXPAUDAT_PAUSEPC_CMN;
+       int ret;
 
        switch (pc) {
        case IEC61937_PC_AC3:
@@ -880,8 +881,13 @@ int aio_oport_set_stream_type(struct uniphier_aio_sub *sub,
                break;
        }
 
-       regmap_write(r, OPORTMXREPET(sub->swm->oport.map), repet);
-       regmap_write(r, OPORTMXPAUDAT(sub->swm->oport.map), pause);
+       ret = regmap_write(r, OPORTMXREPET(sub->swm->oport.map), repet);
+       if (ret)
+               return ret;
+       
+       ret = regmap_write(r, OPORTMXPAUDAT(sub->swm->oport.map), pause);
+       if (ret)
+               return ret;
 
        return 0;
 }