Thread (117 messages) 117 messages, 5 authors, 2022-01-31

Re: [PATCH v2 04/35] brcmfmac: firmware: Support having multiple alt paths

From: Andy Shevchenko <hidden>
Date: 2022-01-06 17:59:19
Also in: linux-acpi, linux-devicetree, linux-wireless, lkml

On Thu, Jan 6, 2022 at 7:40 PM Dmitry Osipenko [off-list ref] wrote:
05.01.2022 16:22, Hector Martin пишет:
quoted
On 05/01/2022 07.09, Dmitry Osipenko wrote:
...
quoted
I'm confused; the array size is constant. What would index contain and
why would would brcm_free_alt_fw_paths use it? Just as an iterator
variable instead of using a local variable? Or do you mean count?
Yes, use index for the count of active entries in the alt_paths[].

for (i = 0; i < alt_paths.index; i++)
        kfree(alt_paths.path[i]);

alt_paths.index = 0;

or

while (alt_paths.index)
        kfree(alt_paths.path[--alt_paths.index]);
Usual pattern is

  while (x--)
    kfree(x);

easier to read, extend (if needed).

-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help