From: Vladimir Oltean <olte...@gmail.com> Date: Wed, 28 Aug 2019 17:48:27 +0300
> taprio_init may fail earlier than this line: > > list_add(&q->taprio_list, &taprio_list); > > i.e. due to the net device not being multi queue. > > Attempting to remove q from the global taprio_list when it is not part > of it will result in a kernel panic. > > Fix it by iterating through the list and removing it only if found. > > Signed-off-by: Vladimir Oltean <olte...@gmail.com> I don't like this solution for two reaons, I think it's actually error prone, and now every taprio_destroy() eats the cost of traversing the entire list. The whole reason to use a list head is O(1) removal. Just init the list head early in the creation then the list_del() just works.