Re: [PATCH 10/17] i3c: renesas: Return immediately if there is nothing to transfer

Frank Li <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel,org.kernel.vger.linux-renesas-soc
Message-ID <ahCsh0KNoZedtNsn@lizhi-Precision-Tower-5810>
subject:
	 Return immediately if nothing transfer

Frank

On Fri, May 22, 2026 at 01:18:08PM +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <[email protected]>
>
> There is no need to allocate a transfer structure when i2c_nxfers is zero.
> Return immediately instead of unnecessarily allocating memory.
>
> Signed-off-by: Claudiu Beznea <[email protected]>
> ---
>  drivers/i3c/master/renesas-i3c.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index e5963270d6e5..de75125eb013 100644
> --- a/drivers/i3c/master/renesas-i3c.c
> +++ b/drivers/i3c/master/renesas-i3c.c
> @@ -940,13 +940,13 @@ static int renesas_i3c_i2c_xfers(struct i2c_dev_desc *dev,
>  	u8 start_bit = CNDCTL_STCND;
>  	int i;
>
> +	if (!i2c_nxfers)
> +		return 0;
> +
>  	struct renesas_i3c_xfer *xfer __free(kfree) = renesas_i3c_alloc_xfer(i3c, 1);
>  	if (!xfer)
>  		return -ENOMEM;
>
> -	if (!i2c_nxfers)
> -		return 0;
> -
>  	renesas_i3c_bus_enable(m, false);
>
>  	init_completion(&xfer->comp);
> --
> 2.43.0
>

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
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.