public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] a100u2w: fix bitmap lookup routine
@ 2008-03-17 12:32 Akinobu Mita
  2008-03-17 13:45 ` Akinobu Mita
  2008-03-17 14:46 ` James Bottomley
  0 siblings, 2 replies; 11+ messages in thread
From: Akinobu Mita @ 2008-03-17 12:32 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, Alan Cox, Christoph Hellwig, Doug Ledford

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>
Cc: Alan Cox <alan@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Doug Ledford <dledford@redhat.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/a100u2w.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: 2.6-rc/drivers/scsi/a100u2w.c
===================================================================
--- 2.6-rc.orig/drivers/scsi/a100u2w.c
+++ 2.6-rc/drivers/scsi/a100u2w.c
@@ -674,12 +674,13 @@ static struct orc_scb *__orc_alloc_scb(s
 		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;
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-03-20 16:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 12:32 [PATCH] a100u2w: fix bitmap lookup routine Akinobu Mita
2008-03-17 13:45 ` Akinobu Mita
2008-03-17 14:46 ` James Bottomley
2008-03-17 16:04   ` Alan Cox
2008-03-19 14:24   ` Alan Cox
2008-03-20  4:56     ` FUJITA Tomonori
2008-03-20  9:34       ` Akinobu Mita
2008-03-20  9:36         ` Akinobu Mita
2008-03-20 14:12         ` Alan Cox
2008-03-20 14:17           ` James Bottomley
2008-03-20 16:34             ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox