It would be safe in this case to just remove the second declaration of flags
and reuse it as it is outside the local_irq_save/restore pair. I did it
way in case there are future changes that might mix up the use of flags.
Feel free to just remove the second flags declaration if you'd rather do