]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
[SCSI] a100u2w: fix bitmap lookup routine
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 17 Mar 2008 12:32:02 +0000 (21:32 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 20 Mar 2008 14:19:25 +0000 (09:19 -0500)
This patch is only compile tested.

It seems that bitmap lookup routine for allocation_map in
a100u2w driver is simply wrong.

It cannot lookup more than first 32 bits. If all first 32 bits
are set, it just returns 33-th orc_scb even though the 33-th bit
is not set.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Tested-by: Alan Cox <alan@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/a100u2w.c

index f608d4a1d6daeaa8b44ca46d25cb3fe2b3cc2276..792b2e807bf32a6151a38e3c2690e2a33c272f90 100644 (file)
@@ -674,12 +674,13 @@ static struct orc_scb *__orc_alloc_scb(struct orc_host * host)
                for (index = 0; index < 32; index++) {
                        if ((host->allocation_map[channel][i] >> index) & 0x01) {
                                host->allocation_map[channel][i] &= ~(1 << index);
-                               break;
+                               idx = index + 32 * i;
+                               /*
+                                * Translate the index to a structure instance
+                                */
+                               return host->scb_virt + idx;
                        }
                }
-               idx = index + 32 * i;
-               /* Translate the index to a structure instance */
-               return (struct orc_scb *) ((unsigned long) host->scb_virt + (idx * sizeof(struct orc_scb)));
        }
        return NULL;
 }