Re: [RFC PATCH 03/13] usb: remove the usage of the list iterator after the loop

From: Linus Torvalds
Date: Thu Feb 24 2022 - 12:57:05 EST


On Thu, Feb 24, 2022 at 2:33 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> So, to follow the proposed solution in this thread, the following change
> is the "correct" one to make, right?

That would indeed be my preference.

If we ever are able to change

list_for_each_entry(tmp, &ep->queue, queue)...

to simply declare 'tmp' as the right type itself, then the e need to do

struct gr_request *tmp;

outside the loop goes away, and this kind of "set a variable that is
declared in the outside context" becomes the only way to do things.

Linus