[PATCH] sound: rt5677: Cannot test unsigned for being negative

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 12 12:36:53 CEST 2025


In rt5677_bic_or the call to rt5677_i2c_read returns an int so old
should also be an int to receive that value and then be able to test it
for being negative which would indicate an error.

This issue was found by Smatch.

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

diff --git a/drivers/sound/rt5677.c b/drivers/sound/rt5677.c
index b5c997c6dd5..a9d1e94951a 100644
--- a/drivers/sound/rt5677.c
+++ b/drivers/sound/rt5677.c
@@ -94,8 +94,8 @@ static int rt5677_i2c_write(struct rt5677_priv *priv, uint reg, uint data)
 static int rt5677_bic_or(struct rt5677_priv *priv, uint reg, uint bic,
 			 uint set)
 {
-	uint old, new_value;
-	int ret;
+	uint new_value;
+	int old, ret;
 
 	old = rt5677_i2c_read(priv, reg);
 	if (old < 0)

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250812-sound_rt5677-e2f8cfc9e8dc

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



More information about the U-Boot mailing list