save_device_states(): fix iteration over all devices (fabio).