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

Andi Shyti <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-i2c,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi,

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

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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.