[PATCH] i2c: bcm2835: add missing braces to for loop in bcm2835_i2c_xfer

zhaohaiyang1 yewentian395 at gmail.com
Mon Aug 17 06:02:34 PDT 2026


From: zhaohaiyang1 <zhaohaiyang1 at xiaomi.com>

Add curly braces around the multi-statement body of the for loop
that checks for unsupported read messages. This fixes a coding
style issue where the compound statement lacked explicit braces.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1 at xiaomi.com>
---
 drivers/i2c/busses/i2c-bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 8554e790f8e3..76d017cf1582 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -349,12 +349,13 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
 	unsigned long time_left;
 	int i;
 
-	for (i = 0; i < (num - 1); i++)
+	for (i = 0; i < (num - 1); i++) {
 		if (msgs[i].flags & I2C_M_RD) {
 			dev_warn_once(i2c_dev->dev,
 				      "only one read message supported, has to be last\n");
 			return -EOPNOTSUPP;
 		}
+	}
 
 	i2c_dev->curr_msg = msgs;
 	i2c_dev->num_msgs = num;
-- 
2.43.0




More information about the linux-arm-kernel mailing list