Commit 66c95e20 authored by Daniele Bellucci's avatar Daniele Bellucci Committed by Greg Kroah-Hartman

[PATCH] Another bad audit in drivers/usb/*: cdc-acm

Changes:
- if tty_register_driver report back its return code rather than -1
- if usb_register fails report back its return code rather than -1
parent 5945d98b
...@@ -767,6 +767,7 @@ static struct tty_operations acm_ops = { ...@@ -767,6 +767,7 @@ static struct tty_operations acm_ops = {
static int __init acm_init(void) static int __init acm_init(void)
{ {
int retval;
acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS); acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS);
if (!acm_tty_driver) if (!acm_tty_driver)
return -ENOMEM; return -ENOMEM;
...@@ -783,15 +784,17 @@ static int __init acm_init(void) ...@@ -783,15 +784,17 @@ static int __init acm_init(void)
acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
tty_set_operations(acm_tty_driver, &acm_ops); tty_set_operations(acm_tty_driver, &acm_ops);
if (tty_register_driver(acm_tty_driver)) { retval = tty_register_driver(acm_tty_driver);
if (retval) {
put_tty_driver(acm_tty_driver); put_tty_driver(acm_tty_driver);
return -1; return retval;
} }
if (usb_register(&acm_driver) < 0) { retval = usb_register(&acm_driver);
if (retval) {
tty_unregister_driver(acm_tty_driver); tty_unregister_driver(acm_tty_driver);
put_tty_driver(acm_tty_driver); put_tty_driver(acm_tty_driver);
return -1; return retval;
} }
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment