Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: bcm2835: add missing braces to for loop in bcm2835_i2c_xfer
@ 2026-08-17 13:02 zhaohaiyang1
  2026-08-18 14:58 ` Andi Shyti
  0 siblings, 1 reply; 2+ messages in thread
From: zhaohaiyang1 @ 2026-08-17 13:02 UTC (permalink / raw)
  To: Andi Shyti, Florian Fainelli
  Cc: bcm-kernel-feedback-list, Ray Jui, Scott Branden, linux-i2c,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, zhaohaiyang1

From: zhaohaiyang1 <zhaohaiyang1@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@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: bcm2835: add missing braces to for loop in bcm2835_i2c_xfer
  2026-08-17 13:02 [PATCH] i2c: bcm2835: add missing braces to for loop in bcm2835_i2c_xfer zhaohaiyang1
@ 2026-08-18 14:58 ` Andi Shyti
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2026-08-18 14:58 UTC (permalink / raw)
  To: zhaohaiyang1
  Cc: Florian Fainelli, bcm-kernel-feedback-list, Ray Jui,
	Scott Branden, linux-i2c, linux-rpi-kernel, linux-arm-kernel,
	linux-kernel, zhaohaiyang1

Hi,

On Mon, Aug 17, 2026 at 09:02:34PM +0800, zhaohaiyang1 wrote:
> From: zhaohaiyang1 <zhaohaiyang1@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.

it's not a multi statement body, if you look very carefully from
closer, there is only one single solitary 'if' statement.

> Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>

Please next time use your real name here.

Thanks,
Andi

> ---
>  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
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-18 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 13:02 [PATCH] i2c: bcm2835: add missing braces to for loop in bcm2835_i2c_xfer zhaohaiyang1
2026-08-18 14:58 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox