[PATCH] drivers/char/epca.c: release resources on failure

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Sun Aug 13 2000 - 07:53:57 EST


Hi,

     Please take a look and consider applying.

                        - Arnaldo

--- linux-2.4.0-test7-pre3/drivers/char/epca.c Fri Jul 28 06:34:41 2000
+++ linux-2.4.0-test7-pre3.acme/drivers/char/epca.c Sun Aug 13 09:50:09 2000
@@ -24,6 +24,10 @@
          along with this program; if not, write to the Free Software
          Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+ Changes:
+ Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ - release previously allocated resources on failure in post_fep_init
+
 --------------------------------------------------------------------------- */
 /* See README.epca for change history --DAT*/
 
@@ -2187,15 +2191,17 @@
                 ch->blocked_open = 0;
                 ch->callout_termios = pc_callout.init_termios;
                 ch->normal_termios = pc_driver.init_termios;
- init_waitqueue_head(&ch->open_wait);
- init_waitqueue_head(&ch->close_wait);
                 ch->tmp_buf = kmalloc(ch->txbufsize,GFP_KERNEL);
- if (!(ch->tmp_buf))
- {
+ if (!ch->tmp_buf) {
                         printk(KERN_ERR "POST FEP INIT : kmalloc failed for port 0x%x\n",i);
+ while(--i >= 0)
+ kfree(card_ptr[crd + i]->tmp_buf);
+ return;
 
                 }
                 memset((void *)ch->tmp_buf,0,ch->txbufsize);
+ init_waitqueue_head(&ch->open_wait);
+ init_waitqueue_head(&ch->close_wait);
         } /* End for each port */
 
         printk(KERN_INFO

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:30 EST