Merge "Further cleanup of the logic in device_init."