diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
commit | 012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch) | |
tree | 87efc733f9b164e8c85c0336f92c8fb7eff6d183 /drivers/scsi/3w-xxxx.c | |
parent | 625a1589d3d6464b5d90b8a0918789e3afffd220 (diff) |
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found
that this kernel will only boot SMP on Origin; the UP kernel freeze
soon after bootup with SCSI timeout messages. I commit this anyway
since I found that the last CVS versions had the same problem.
Diffstat (limited to 'drivers/scsi/3w-xxxx.c')
-rw-r--r-- | drivers/scsi/3w-xxxx.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index ba6cc03cf..cb70168a3 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -3,6 +3,7 @@ Written By: Adam Radford <linux@3ware.com> Modifications By: Joel Jacobson <linux@3ware.com> + Arnaldo Carvalho de Melo <acme@conectiva.com.br> Copyright (C) 1999-2000 3ware Inc. @@ -64,6 +65,8 @@ Bug fix so hot spare drives don't show up. 1.02.00.002 - Fix bug with tw_setfeature() call that caused oops on some systems. + 08/21/00 - release previously allocated resources on failure at + tw_allocate_memory (acme) */ #include <linux/module.h> @@ -410,35 +413,26 @@ int tw_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) /* This function will allocate memory and check if it is 16 d-word aligned */ int tw_allocate_memory(TW_Device_Extension *tw_dev, int request_id, int size, int which) { - u32 *virt_addr; + u32 *virt_addr = kmalloc(size, GFP_ATOMIC); dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n"); + if (!virt_addr) { + printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); + return 1; + } + + if ((u32)virt_addr % TW_ALIGNMENT) { + kfree(virt_addr); + printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); + return 1; + } + if (which == 0) { - /* Allocate command packet memory */ - virt_addr = kmalloc(size, GFP_ATOMIC); - if (virt_addr == NULL) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); - return 1; - } - if ((u32)virt_addr % TW_ALIGNMENT) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); - return 1; - } tw_dev->command_packet_virtual_address[request_id] = virt_addr; tw_dev->command_packet_physical_address[request_id] = virt_to_bus(virt_addr); } else { - /* Allocate generic buffer */ - virt_addr = kmalloc(size, GFP_ATOMIC); - if (virt_addr == NULL) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); - return 1; - } - if ((u32)virt_addr % TW_ALIGNMENT) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); - return 1; - } tw_dev->alignment_virtual_address[request_id] = virt_addr; tw_dev->alignment_physical_address[request_id] = virt_to_bus(virt_addr); } @@ -2390,7 +2384,6 @@ void tw_unmask_command_interrupt(TW_Device_Extension *tw_dev) /* Now get things going */ -#ifdef MODULE -Scsi_Host_Template driver_template = TWXXXX; +static Scsi_Host_Template driver_template = TWXXXX; #include "scsi_module.c" -#endif + |