OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:08:55 +0000 (09:08 -0700)
commitf2e1e0a0afd3549c87c97ec2b3363b7325c6e3d5
treed61c8e0ec6b167576f5fe7001a769a921ba06219
parentab14444f6f3dd3cd0a47ad4bcc35fed256d1e9a7
xtensa: ISS: don't hang if stdin EOF is reached

commit 362014c8d9d51d504c167c44ac280169457732be upstream.

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.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/platforms/iss/console.c