Skip to contentSkip to conversation

a trival bug of megaraid in patch 2.6.12-mm1

PATCH bobl 3 participants 4 messages Jun 21, 2005

Subsystems (2)
lore
Share & tools
lore

bobl

author
#0 lore raw

Hi, Andrew Morton:

In 2.6.12-mm1 patch, there are some lines as follow:

300379 +static int
300380 +megaraid_reset(Scsi_Cmnd *cmd)
300381 +{
300382 + adapter = (adapter_t *)cmd->device->host->hostdata;
300383 + int rc;
300384 +

300385 +       spin_lock_irq(&adapter->lock);
300386 +       rc = __megaraid_reset(cmd);
300387 +       spin_unlock_irq(&adapter->lock);

300388 +
300389 + return rc;
300390 +}

I think between line 300381 and 300382 should add follow line:

      adapter_t       *adapter;

The attachment is the patch, please confirm it.

Best Regards

Bob

drivers/scsi/megaraid.c +1 -0
diff -purN linux-2.6.12/drivers/scsi/megaraid.c linux-2.6.12.new/drivers/scsi/megaraid.c
@@ -1975,6 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)
 static int
 megaraid_reset(Scsi_Cmnd *cmd)
 {
+	adapter_t	*adapter;
 	adapter = (adapter_t *)cmd->device->host->hostdata;
 	int rc;
 
#1 lore raw

Quoting bobl <[email protected]>:

drivers/scsi/megaraid.c 2005-06-21 18:57:55.266978560 +0900 __megaraid_reset(Scsi_Cmnd *cmd) · line 1980

Quoted 12 lines

The attachment is the patch, please confirm it.

diff -purN linux-2.6.12/drivers/scsi/megaraid.c linux-2.6.12.new/drivers/scsi/megaraid.c

drivers/scsi/megaraid.c 2005-06-21 18:57:55.266978560 +0900 renamed from drivers/scsi/megaraid.c 2005-06-21 18:49:50.118732304 +0900 +1 -0
@@ -1975,6 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)
 static int
 megaraid_reset(Scsi_Cmnd *cmd)
 {
+       adapter_t       *adapter;
        adapter = (adapter_t *)cmd->device->host->hostdata;
        int rc;

That's mixed code and declarations (aka Not Good (tm)). Please do something like this instead:

- adapter = (adapter_t *)cmd->device->host->hostdata;

+       adapter_t *adapter = (adapter_t *)cmd->device->host->hostdata;
        int rc;
Signature · 1 line
Greetings, Michael
author
#2 lore raw
Quoted 29 lines · Michael Buesch

Quoting bobl <[email protected]>:

Quoted 13 lines

The attachment is the patch, please confirm it.

diff -purN linux-2.6.12/drivers/scsi/megaraid.c linux-2.6.12.new/drivers/scsi/megaraid.c

drivers/scsi/megaraid.c 2005-06-21 18:57:55.266978560 +0900 renamed from drivers/scsi/megaraid.c 2005-06-21 18:49:50.118732304 +0900 +0 -0
@@ -1975,6 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)

static int
megaraid_reset(Scsi_Cmnd *cmd)
{

Quoted 5 lines
+       adapter_t       *adapter;
       adapter = (adapter_t *)cmd->device->host->hostdata;
       int rc;

That's mixed code and declarations (aka Not Good (tm)). Please do something like this instead:

Review

Quoted 3 lines
(quoted diff) +1 -1
-       adapter = (adapter_t *)cmd->device->host->hostdata;
+       adapter_t *adapter = (adapter_t *)cmd->device->host->hostdata;
       int rc;

Thanks!

The attachment is the new one!

drivers/scsi/megaraid.c +1 -1
diff -purN linux-2.6.12.orig/drivers/scsi/megaraid.c linux-2.6.12.new/drivers/scsi/megaraid.c
@@ -1975,7 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)
 static int
 megaraid_reset(Scsi_Cmnd *cmd)
 {
-	adapter = (adapter_t *)cmd->device->host->hostdata;
+	adapter_t *adapter = (adapter_t *)cmd->device->host->hostdata;
 	int rc;
 
 	spin_lock_irq(&adapter->lock);
#3 lore raw
In reply to bobl
Quoted 35 lines · bobl

Hi, Andrew Morton:

In 2.6.12-mm1 patch, there are some lines as follow:

300379 +static int
300380 +megaraid_reset(Scsi_Cmnd *cmd)
300381 +{
300382 + adapter = (adapter_t *)cmd->device->host->hostdata;
300383 + int rc;
300384 +

300385 +       spin_lock_irq(&adapter->lock);
300386 +       rc = __megaraid_reset(cmd);
300387 +       spin_unlock_irq(&adapter->lock);

300388 +
300389 + return rc;
300390 +}

I think between line 300381 and 300382 should add follow line:

      adapter_t       *adapter;

The attachment is the patch, please confirm it.

Best Regards

Bob

------------------------------------------------------------------------

diff -purN linux-2.6.12/drivers/scsi/megaraid.c linux-2.6.12.new/drivers/scsi/megaraid.c

drivers/scsi/megaraid.c __megaraid_reset(Scsi_Cmnd *cmd) · line 1981

Quoted 7 lines
drivers/scsi/megaraid.c +1 -0
@@ -1975,6 +1975,7 @@ __megaraid_reset(Scsi_Cmnd *cmd)
 static int
 megaraid_reset(Scsi_Cmnd *cmd)
 {
+	adapter_t	*adapter;
 	adapter = (adapter_t *)cmd->device->host->hostdata;
 	int rc;
 

I think this is my screw-up. I'll get the fix in...

Jeff