staging: comedi: return error on "write" if no command set up
authorIan Abbott <abbotti@mev.co.uk>
Wed, 18 Nov 2015 17:55:09 +0000 (17:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2015 23:58:54 +0000 (15:58 -0800)
commit40d0e80e08012ac99b187cbaaeb8aab92b71714d
tree779e97ea7e0188c9418f959f3dc4780b5c1f9ddd
parent35a7475dc818320915e89ed0217872ff1ab66ec2
staging: comedi: return error on "write" if no command set up

The "write" file operation handler, `comedi_write()` returns an error
for pretty much any condition that prevents a "write" going ahead.  One
of the conditions that prevents a "write" going ahead is that no
asynchronous command has been set up, but that currently results in a
return value of 0 (unless COMEDI instructions are being processed or an
asynchronous command has been set up by a different file object).
Change it to return `-EINVAL` in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c