]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/dgrp/dgrp_tty.c
mtip32xx: fix potential crash on SEC_ERASE_UNIT
[~andy/linux] / drivers / staging / dgrp / dgrp_tty.c
index 72f6fcfa98783a3175bf0351720fb5ec1cb64d49..e125b03598d73e5b40815cad70887793162802c5 100644 (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;