kernel_thread() audit drivers/scsi/aacraid/rkt.c
Subsystems (2)
Cleaned up code for error handing. Added checks to unmap memory, release IRQ's, and freeing up dev->queue.
Signed-off-by MJK <[email protected]>
Signed-off-by Maximilian Attems <[email protected]>
---
linux-2.6.7-max/drivers/scsi/aacraid/rkt.c | 25 ++++++++++++++++++------- 1 files changed, 18 insertions(+), 7 deletions(-)
drivers/scsi/aacraid/rkt.c renamed from drivers/scsi/aacraid/rkt.c~kernel_thread-aacraid-rkt +18 -7
@@ -383,21 +383,21 @@ int aac_rkt_init(struct aac_dev *dev, unif ((dev->regs.rkt = (struct rkt_registers *)ioremap ((unsigned long )dev->scsi_host_ptr->base,8192 ))==NULL ) {printk (KERN_WARNING "aacraid: unable to map i960.\n" ); -return -1 ; + goto error_iounmap; }/* * Check to see if the board failed any self tests. */ if (rkt_readl (dev, IndexRegs.Mailbox[7 ]) &SELF_TEST_FAILED ) {printk (KERN_ERR "%s%d: adapter self-test failed.\n" , dev->name, instance); -return -1 ; + goto error_iounmap; }/* * Check to see if the board panic'd while booting. */ if (rkt_readl (dev, IndexRegs.Mailbox[7 ]) &KERNEL_PANIC ) {printk (KERN_ERR "%s%d: adapter kernel panic'd.\n" , dev->name, instance); -return -1 ; + goto error_iounmap; } start = jiffies;/*
@@ -409,7 +409,7 @@ int aac_rkt_init(struct aac_dev *dev, un { status =rkt_readl (dev, IndexRegs.Mailbox[7 ]) >>16 ;printk (KERN_ERR "%s%d: adapter kernel failed to start, init status = %ld.\n" , dev->name, instance, status); -return -1 ; + goto error_iounmap; }set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 );
@@ -417,7 +417,7 @@ int aac_rkt_init(struct aac_dev *dev, unif (request_irq (dev->scsi_host_ptr->irq, aac_rkt_intr,SA_SHIRQ |SA_INTERRUPT ,"aacraid" , (void *)dev)<0 ) {printk (KERN_ERR "%s%d: Interrupt unavailable.\n" , name, instance); -return -1 ; + goto error_iounmap; }/* * Fill in the function dispatch table.
@@ -430,7 +430,7 @@ int aac_rkt_init(struct aac_dev *dev, un dev->a_ops.adapter_check_health = aac_rkt_check_health;if (aac_init_adapter (dev) ==NULL ) -return -1 ; + goto error_irq;/* * Start any kernel threads needed */
@@ -438,7 +438,7 @@ int aac_rkt_init(struct aac_dev *dev, unif (dev->thread_pid <0 ) {printk (KERN_ERR "aacraid: Unable to create rkt thread.\n" ); -return -1 ; + goto error_kfree; }/* * Tell the adapter that all is configured, and it can start
@@ -446,4 +446,15 @@ int aac_rkt_init(struct aac_dev *dev, un*/ aac_rkt_start_adapter (dev);return 0 ; + +error_kfree: +kfree (dev->queues); + +error_irq: +free_irq (dev->scsi_host_ptr->irq, (void *)dev); + +error_iounmap: +iounmap (dev->regs.rkt); + +return -1 ; }
_