[PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts

Marc Zyngier maz at kernel.org
Sat Jun 12 04:10:43 PDT 2021


On Sat, 12 Jun 2021 12:00:14 +0100,
Austin Kim <austindh.kim at gmail.com> wrote:
> 
> From: Austin Kim <austin.kim at lge.com>
> 
> Normally local variable 'flags' is defined out of for loop,
> when 'flags' is used as the second parameter in a call to
> spinlock_irq[save/restore] function.
> 
> So it had better declear local variable 'flags' ahead of for loop.

Why better? Reducing the scope of a variable is in general good
practice. Do you see any material advantage in moving this variable
out of the loop? Does the compiler generate better code?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list