[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221208100603.29588-1-jiasheng@iscas.ac.cn>
Date: Thu, 8 Dec 2022 18:06:03 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: leon@...nel.org
Cc: jiri@...nulli.us, jesse.brandeburg@...el.com,
anthony.l.nguyen@...el.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: [PATCH net v2] ice: Add check for kzalloc
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
Powered by blists - more mailing lists