2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 01:34:00 +08:00

staging: dgrp: check return value of alloc_tty_driver

alloc_tty_driver was always assumed to succeed.  Add code to check the
return value and return -ENOMEM if alloc_tty_driver fails.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bill Pemberton 2012-10-09 14:18:20 -04:00 committed by Greg Kroah-Hartman
parent d7c4660c12
commit 178e485a0e

View File

@ -3173,6 +3173,9 @@ dgrp_tty_init(struct nd_struct *nd)
*/
nd->nd_serial_ttdriver = alloc_tty_driver(CHAN_MAX);
if (!nd->nd_serial_ttdriver)
return -ENOMEM;
sprintf(nd->nd_serial_name, "tty_dgrp_%s_", id);
nd->nd_serial_ttdriver->owner = THIS_MODULE;
@ -3232,6 +3235,9 @@ dgrp_tty_init(struct nd_struct *nd)
}
nd->nd_callout_ttdriver = alloc_tty_driver(CHAN_MAX);
if (!nd->nd_callout_ttdriver)
return -ENOMEM;
sprintf(nd->nd_callout_name, "cu_dgrp_%s_", id);
nd->nd_callout_ttdriver->owner = THIS_MODULE;
@ -3269,6 +3275,9 @@ dgrp_tty_init(struct nd_struct *nd)
nd->nd_xprint_ttdriver = alloc_tty_driver(CHAN_MAX);
if (!nd->nd_xprint_ttdriver)
return -ENOMEM;
sprintf(nd->nd_xprint_name, "pr_dgrp_%s_", id);
nd->nd_xprint_ttdriver->owner = THIS_MODULE;