Commit 72e4846d authored by James Bottomley's avatar James Bottomley

[patch-kj] kernel_thread() audit drivers/scsi/aacraid/rkt.c

From: 	maximilian attems <janitor@sternwelten.at>

Cleaned up code for error handing. Added checks to unmap memory,
release IRQ's, and freeing up dev->queue.
Signed-off-by: default avatarMJK <mkemp@cs.nmsu.edu>
Signed-off-by: default avatarMaximilian Attems <janitor@sternwelten.at>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
(fixed up rejects by hand)
parent cdf247f5
......@@ -408,28 +408,28 @@ int aac_rkt_init(struct aac_dev *dev)
if((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, MUnit.OMRx[0]) & 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 monitor panic'd while booting.
*/
if (rkt_readl(dev, MUnit.OMRx[0]) & MONITOR_PANIC) {
printk(KERN_ERR "%s%d: adapter monitor panic.\n", dev->name, instance);
return -1;
goto error_iounmap;
}
/*
* Check to see if the board panic'd while booting.
*/
if (rkt_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) {
printk(KERN_ERR "%s%d: adapter kernel panic'd.\n", dev->name, instance);
return -1;
goto error_iounmap;
}
start = jiffies;
/*
......@@ -441,7 +441,7 @@ int aac_rkt_init(struct aac_dev *dev)
{
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);
......@@ -449,7 +449,7 @@ int aac_rkt_init(struct aac_dev *dev)
if (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.
......@@ -462,7 +462,7 @@ int aac_rkt_init(struct aac_dev *dev)
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
*/
......@@ -470,7 +470,7 @@ int aac_rkt_init(struct aac_dev *dev)
if(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
......@@ -478,4 +478,15 @@ int aac_rkt_init(struct aac_dev *dev)
*/
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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment