Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.19 /drivers/char/tpqic02.c

Filename:/drivers/char/tpqic02.c
Lines Added:7
Lines Deleted:13
Also changed in: (Previous) 2.4.19-rc5  2.4.19-rc4  2.4.19-rc3  2.4.19-rc2  2.4.19-rc1  2.4.19-pre10 
(Following) 2.4.19-ac4  2.4.20-pre1-ac1  2.4.20-pre2  2.4.20-pre1-ac2  2.4.20-pre1-ac3  2.4.20-pre3 

Location
[  2.4.19
  [  drivers
    [  char
       o  tpqic02.c

Patch

diff -urN linux-2.4.18/drivers/char/tpqic02.c linux-2.4.19/drivers/char/tpqic02.c
--- linux-2.4.18/drivers/char/tpqic02.c   Fri Sep 14 14:40:00 2001
+++ linux-2.4.19/drivers/char/tpqic02.c   Fri Aug  2 17:39:43 2002
@@ -1944,12 +1944,8 @@
          }
          /* copy buffer to user-space in one go */
          if (bytes_done > 0) {
-            err =
-                copy_to_user(buf, buffaddr,
-                   bytes_done);
-            if (err) {
+            if (copy_to_user(buf, buffaddr, bytes_done))
                return -EFAULT;
-            }
          }
 #if 1
          /* Checks Ton's patch below */
@@ -2085,10 +2081,8 @@
 
       /* copy from user to DMA buffer and initiate transfer. */
       if (bytes_todo > 0) {
-         err = copy_from_user(buffaddr, buf, bytes_todo);
-         if (err) {
+         if (copy_from_user(buffaddr, buf, bytes_todo))
             return -EFAULT;
-         }
 
 /****************** similar problem with read() at FM could happen here at EOT.
  ******************/
@@ -2750,7 +2744,9 @@
     * the config parameters have been set using MTSETCONFIG.
     */
 
-   if (check_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE)) {
+   /* Grab the IO region. */
+   if (!request_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE,
+            TPQIC02_NAME)) {
       printk(TPQIC02_NAME
              ": IO space at 0x%x [%d ports] already reserved\n",
              QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
@@ -2764,6 +2760,7 @@
       printk(TPQIC02_NAME
              ": can't allocate IRQ%d for QIC-02 tape\n",
              QIC02_TAPE_IRQ);
+      release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
       return -EBUSY;
    }
 
@@ -2773,13 +2770,10 @@
              ": can't allocate DMA%d for QIC-02 tape\n",
              QIC02_TAPE_DMA);
       free_irq(QIC02_TAPE_IRQ, NULL);
+      release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
       return -EBUSY;
    }
 
-   /* Grab the IO region. We already made sure it's available. */
-   request_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE,
-             TPQIC02_NAME);
-
    /* Setup the page-address for the dma transfer. */
    buffaddr =
        (void *) __get_dma_pages(GFP_KERNEL, get_order(TPQBUF_SIZE));


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.