netif: Add proper lock protect for accessing netif->loop_first

All the reset part of the code accessing netif->loop_first has lock protection,
the only missing part is "while (netif->loop_first != NULL)".
Fix it by adding lock protect around the while loop.

Also convert the code to use while{} loop instead of do .. while{} loop,
then we can avoid NULL test for in pointer in each loop and reduce a level of indent.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
1 file changed