]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aha152x.c
[SCSI] aha152x: Fix oops on module removal
[linux-2.6-omap-h63xx.git] / drivers / scsi / aha152x.c
index a09b2d3fdf5a30ced18a487b799fa7598be05455..1dca1775f4b14554213fc366b89433e78f2af11c 100644 (file)
@@ -994,13 +994,13 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
        SCpnt->SCp.sent_command = 0;
 
        if(SCpnt->SCp.phase & (resetting|check_condition)) {
-               if(SCpnt->host_scribble==0 || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
+               if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
                        printk(ERR_LEAD "cannot reuse command\n", CMDINFO(SCpnt));
                        return FAILED;
                }
        } else {
                SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC);
-               if(SCpnt->host_scribble==0) {
+               if(!SCpnt->host_scribble) {
                        printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt));
                        return FAILED;
                }
@@ -1162,7 +1162,7 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
        }
 
        DO_LOCK(flags);
-       issued       = remove_SC(&ISSUE_SC, SCpnt)==0;
+       issued       = remove_SC(&ISSUE_SC, SCpnt) == NULL;
        disconnected = issued && remove_SC(&DISCONNECTED_SC, SCpnt);
        DO_UNLOCK(flags);
 
@@ -3830,7 +3830,7 @@ static int __init aha152x_init(void)
                        iounmap(p);
                }
                if (!ok && setup_count == 0)
-                       return 0;
+                       return -ENODEV;
 
                printk(KERN_INFO "aha152x: BIOS test: passed, ");
 #else
@@ -3909,14 +3909,14 @@ static int __init aha152x_init(void)
 #endif
        }
 
-       return 1;
+       return 0;
 }
 
 static void __exit aha152x_exit(void)
 {
-       struct aha152x_hostdata *hd;
+       struct aha152x_hostdata *hd, *tmp;
 
-       list_for_each_entry(hd, &aha152x_host_list, host_list) {
+       list_for_each_entry_safe(hd, tmp, &aha152x_host_list, host_list) {
                struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
 
                aha152x_release(shost);