summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 00:54:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 08:29:47 -0700
commit8cd64518a3d166a21f5c69ac7860b3add0369dd0 (patch)
tree980a3652e61c695b1c199362f735cb0b4e11d7aa
parentfb100b6ea7bf8a95e52b90cc0dc0ea5744a0a40a (diff)
downloadop-kernel-dev-8cd64518a3d166a21f5c69ac7860b3add0369dd0.zip
op-kernel-dev-8cd64518a3d166a21f5c69ac7860b3add0369dd0.tar.gz
isicom: fix buffer allocation
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>
-rw-r--r--drivers/char/isicom.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 9c6be8d..4f3cefa 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -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);
OpenPOWER on IntegriCloud