aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBill Pemberton <wfp5p@virginia.edu>2012-10-09 14:18:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-17 17:10:10 -0400
commit178e485a0ebbfdb7165b4363d8fea2a07d650c0b (patch)
treeff94d339f1dac78e5ab4236cb0bd56ec85516dfa /drivers
parentd7c4660c12adc5c66351253af381259686fa08a4 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/dgrp/dgrp_tty.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/dgrp/dgrp_tty.c b/drivers/staging/dgrp/dgrp_tty.c
index 72f6fcfa9878..e125b03598d7 100644
--- a/drivers/staging/dgrp/dgrp_tty.c
+++ b/drivers/staging/dgrp/dgrp_tty.c
@@ -3173,6 +3173,9 @@ dgrp_tty_init(struct nd_struct *nd)
3173 */ 3173 */
3174 3174
3175 nd->nd_serial_ttdriver = alloc_tty_driver(CHAN_MAX); 3175 nd->nd_serial_ttdriver = alloc_tty_driver(CHAN_MAX);
3176 if (!nd->nd_serial_ttdriver)
3177 return -ENOMEM;
3178
3176 sprintf(nd->nd_serial_name, "tty_dgrp_%s_", id); 3179 sprintf(nd->nd_serial_name, "tty_dgrp_%s_", id);
3177 3180
3178 nd->nd_serial_ttdriver->owner = THIS_MODULE; 3181 nd->nd_serial_ttdriver->owner = THIS_MODULE;
@@ -3232,6 +3235,9 @@ dgrp_tty_init(struct nd_struct *nd)
3232 } 3235 }
3233 3236
3234 nd->nd_callout_ttdriver = alloc_tty_driver(CHAN_MAX); 3237 nd->nd_callout_ttdriver = alloc_tty_driver(CHAN_MAX);
3238 if (!nd->nd_callout_ttdriver)
3239 return -ENOMEM;
3240
3235 sprintf(nd->nd_callout_name, "cu_dgrp_%s_", id); 3241 sprintf(nd->nd_callout_name, "cu_dgrp_%s_", id);
3236 3242
3237 nd->nd_callout_ttdriver->owner = THIS_MODULE; 3243 nd->nd_callout_ttdriver->owner = THIS_MODULE;
@@ -3269,6 +3275,9 @@ dgrp_tty_init(struct nd_struct *nd)
3269 3275
3270 3276
3271 nd->nd_xprint_ttdriver = alloc_tty_driver(CHAN_MAX); 3277 nd->nd_xprint_ttdriver = alloc_tty_driver(CHAN_MAX);
3278 if (!nd->nd_xprint_ttdriver)
3279 return -ENOMEM;
3280
3272 sprintf(nd->nd_xprint_name, "pr_dgrp_%s_", id); 3281 sprintf(nd->nd_xprint_name, "pr_dgrp_%s_", id);
3273 3282
3274 nd->nd_xprint_ttdriver->owner = THIS_MODULE; 3283 nd->nd_xprint_ttdriver->owner = THIS_MODULE;