[PATCH 2/4] pinctrl: stmfx: Remove duplicated code

Andrew Goodbody andrew.goodbody at linaro.org
Thu Aug 7 12:04:03 CEST 2025


In stmfx_read_reg there is duplicated code to detect ret < 0 and return
ret if so. Remove one version of it.

This issue was found by Smatch.

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

diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index 61f335c4eb1..0d5778faef9 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -87,7 +87,7 @@ static int stmfx_read_reg(struct udevice *dev, u8 reg_base, uint offset)
 	if (ret < 0)
 		return ret;
 
-	return ret < 0 ? ret : !!(ret & mask);
+	return !!(ret & mask);
 }
 
 static int stmfx_write_reg(struct udevice *dev, u8 reg_base, uint offset,

-- 
2.39.5



More information about the U-Boot mailing list