From: Alan Cox Date: Wed, 30 Apr 2008 07:54:17 +0000 (-0700) Subject: isicom: fix buffer allocation X-Git-Tag: v2.6.26-rc1~177 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cd64518a3d166a21f5c69ac7860b3add0369dd0;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 --- 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);