twister: Initialise unbound 'hardware' variable

hardware was referenced as return value, without being declared. When the
program goes into the 'except' path, hardware is unbound, but returned,
which throws an error:

`UnboundLocalError`: local variable 'hardware' referenced before assignment

Signed-off-by: Manoel Brunnen <manoel.brunnen@ithinx.io>
This commit is contained in:
Manoel Brunnen 2023-07-10 12:15:55 +02:00 committed by Anas Nashif
commit 368b0e0d16

View file

@ -452,6 +452,7 @@ class DeviceHandler(Handler):
logger.error("{} timed out".format(script))
def get_hardware(self):
hardware = None
try:
hardware = self.device_is_available(self.instance)
while not hardware: