isicom: fix buffer allocation
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Wed, 30 Apr 2008 07:54:17 +0000 (00:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Apr 2008 15:29:47 +0000 (08:29 -0700)
Fix the rather strange buffer management on open that turned up while auditing
for BKL dependencies.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/isicom.c

index 9c6be8da220c12d56bf5caf24affda8e3cb4515c..4f3cefa8eb0e28cd0632983e66cebc63e5bb82ae 100644 (file)
@@ -813,15 +813,13 @@ static int isicom_setup_port(struct isi_port *port)
                return 0;
        if (!port->xmit_buf) {
                /* Relies on BKL */
-               void *xmit_buf = (void *)get_zeroed_page(GFP_KERNEL);
-
-               if (xmit_buf == NULL)
+               unsigned long page  = get_zeroed_page(GFP_KERNEL);
+               if (page == 0)
                        return -ENOMEM;
-               if (port->xmit_buf) {
-                       free_page((unsigned long)xmit_buf);
-                       return -ERESTARTSYS;
-               }
-               port->xmit_buf = xmit_buf;
+               if (port->xmit_buf)
+                       free_page(page);
+               else
+                       port->xmit_buf = (unsigned char *) page;
        }
 
        spin_lock_irqsave(&card->card_lock, flags);