xtensa: ISS: don't hang if stdin EOF is reached
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 8 Feb 2016 22:02:38 +0000 (01:02 +0300)
committerSasha Levin <sasha.levin@oracle.com>
Mon, 18 Apr 2016 12:50:54 +0000 (08:50 -0400)
commit1ef6e487322a28195a9e68bd376944b7ec6db6c2
tree1b6124ab14245f6e1811a9437857d928dfd0210e
parenta14fea4d0284643ffd8538d2204cfb1fa8ac804d
xtensa: ISS: don't hang if stdin EOF is reached

[ Upstream commit 362014c8d9d51d504c167c44ac280169457732be ]

Simulator stdin may be connected to a file, when its end is reached
kernel hangs in infinite loop inside rs_poll, because simc_poll always
signals that descriptor 0 is readable and simc_read always returns 0.
Check simc_read return value and exit loop if it's not positive. Also
don't rewind polling timer if it's zero.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/xtensa/platforms/iss/console.c