On Thu, Apr 06, 2017 at 09:49:09AM +0100, Joao Pinto wrote:
[...]
>  err_init_rx_buffers:
> -     while (--i >= 0)
> -             stmmac_free_rx_buffer(priv, i);
> +     while (queue >= 0) {

I /think/ this could simply be:

        while (queue--) {
                ...
        }

That evaluates before the decrement and hence properly deals with the
case of 0. The difference to your code is that it will skip the first
iteration, but I think that's fine because stmmac_init_rx_buffers()
already cleans up properly, so the queue'th element doesn't have to
be freed again.

Anyway, I think your version will work just as well.

Thierry

Attachment: signature.asc
Description: PGP signature

Reply via email to