logo       

Re: [Kernel-janitors] [PATCH] kernel_thread() audit drivers/scsi/aacraid/rx: msg#00205

Subject: Re: [Kernel-janitors] [PATCH] kernel_thread() audit drivers/scsi/aacraid/rx.c (2.6.7-rc1)
On Thu, 27 May 2004 22:07:24 -0600 (MDT) MJK wrote:

| 
|       Took suggestions (Thanks Randy, Mark!). I also noticed that else
| where in aac_rx_init() there are error returns but no iounmapping. Should
| I also fix that behavior?

Yes.  Each return path needs to deallocate/free whatever has been
allocated up to that point.  However, don't duplicate code at
each return point.  At the first return point, use something like
'goto err_reason1;' and do whatever needs to be done there.
At the second return point, use 'goto err_reason2;' and do what
needs to be done there, and then fall thru to the <reason1> code.
(and use meaningful names for the reasons.)

There are plenty of examples of error-handling code like this if
you have problems with it.

Then after rx.c is done, rkt.c and sa.c need to the same treatments... :)


|       Signed-off-by: MJK <mkemp@xxxxxxxxxxx>
| 
| Cordially,
| M. Kemp
| 
| --- old.linux-2.6.7-rc1/drivers/scsi/aacraid/rx.c     2004-05-09 
20:33:22.000000000 -0600
| +++ new.linux-2.6.7-rc1/drivers/scsi/aacraid/rx.c     2004-05-27 
21:42:40.283536451 -0600
| @@ -435,6 +435,13 @@
|        *      Start any kernel threads needed
|        */
|       dev->thread_pid = kernel_thread((int (*)(void *))aac_command_thread, 
dev, 0);
| +     if (dev->thread_pid < 0) {
| +             printk(KERN_ERR "aacraid: unable to create i960 command 
thread.\n");
| +             free_irq(dev->scsi_host_ptr->irq, (void *)dev);
| +             kfree(dev->queues);
| +             iounmap(dev->regs.rx);
| +             return -1;
| +     }
|       /*
|        *      Tell the adapter that all is configured, and it can start
|        *      accepting requests
| 


--
~Randy
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@xxxxxxxxxxxxxx
http://lists.osdl.org/mailman/listinfo/kernel-janitors
<Prev in Thread] Current Thread [Next in Thread>