[PATCH] sound: maxim_codec: Fix coding mistake

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 12 12:26:06 CEST 2025


In maxim_i2c_read the code mistakenly just returned the return value
from dm_i2c_read leaving the following code unreachable. Instead assign
ret to be the return value from dm_i2c_read so that the following code
can operate as expected.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/sound/maxim_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/sound/maxim_codec.c b/drivers/sound/maxim_codec.c
index 98f094c0e9a..505a739ad7d 100644
--- a/drivers/sound/maxim_codec.c
+++ b/drivers/sound/maxim_codec.c
@@ -45,7 +45,7 @@ unsigned int maxim_i2c_read(struct maxim_priv *priv, unsigned int reg,
 {
 	int ret;
 
-	return dm_i2c_read(priv->dev, reg, data, 1);
+	ret = dm_i2c_read(priv->dev, reg, data, 1);
 	if (ret != 0) {
 		debug("%s: Error while reading register %#04x\n",
 		      __func__, reg);

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250812-maxim_codec-2e57638830ca

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list