Re: [PATCH net v2] ice: Add check for kzalloc
From: Jiasheng Jiang
Date: Thu Dec 08 2022 - 05:06:30 EST
On Thu, Dec 08, 2022 at 05:25:02PM +0800, Leon Romanovsky wrote:
>> +err_out:
>> + for (j = 0; j < i; j++) {
>
> You don't need an extra variable, "while(i--)" will do the trick.
No, the right range is [0, i - 1], but the "while(i--)" is [1, i].
If using "while(i--)", the code should be "tty_port_destroy(pf->gnss_tty_port[i - 1]);".
It will be more complex.
Therefore, it is worthwhile to use an extra varaible.
Thanks,
Jiang