HID: hidraw: fix nonblock read return EAGAIN after device removed
authorFounder Fang <founder.fang@gmail.com>
Wed, 21 Nov 2012 07:20:31 +0000 (15:20 +0800)
committerJiri Kosina <jkosina@suse.cz>
Mon, 26 Nov 2012 13:18:15 +0000 (14:18 +0100)
commit7611e8d26d8dd0e5e132b46e905cb579daf9da1e
tree5cf31a59a211195fd15d9f6089b79fd64a1bebcf
parent1a1e8c6fada5f6dc48aa5dad453c9d9ebfdc8218
HID: hidraw: fix nonblock read return EAGAIN after device removed

When nonblock read the condition check (file->f_flags & O_NONBLOCK) always be
true, signal_pending and device exist checking never get a chance to run, so
the user mode code always get EAGAIN even if device removed. move nonblock mode
checking to the last can fix this problem.

Signed-off-by: Founder Fang <founder.fang@gmail.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hidraw.c