[PATCH 4.9 046/175] serial_core: Check for port state when tty is in error state