acm: Return ENODEV instead of EINVAL when trying to open ACM device.
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Thu, 25 Jun 2009 13:41:24 +0000 (14:41 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 25 Jun 2009 18:24:26 +0000 (11:24 -0700)
This is required, otherwise a user will get a EINVAL while opening a
non-existing device, instead of ENODEV.

This is what I get with this patch applied now instead of an "Invalid
argument".

  cascardo@vespa:~$ cat /dev/ttyACM0
  cat: /dev/ttyACM0: No such device
  cascardo@vespa:~$

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/usb/class/cdc-acm.c

index 38bfdb0f666058061081e6035512843cb0eaa850..02eb60bb6795625252880fa0abc2d43033dced6f 100644 (file)
@@ -550,7 +550,7 @@ static void acm_waker(struct work_struct *waker)
 static int acm_tty_open(struct tty_struct *tty, struct file *filp)
 {
        struct acm *acm;
-       int rv = -EINVAL;
+       int rv = -ENODEV;
        int i;
        dbg("Entering acm_tty_open.");