cppcheck: fix variables reassigned before having been used

Change-Id: I0b1025f2697e5cd7abfe5ca9e3c64f02469ba606