From 8cd64518a3d166a21f5c69ac7860b3add0369dd0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 30 Apr 2008 00:54:17 -0700 Subject: [PATCH] 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 Cc: Jiri Slaby Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/isicom.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 9c6be8da220..4f3cefa8eb0 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); -- 2.20.1