Commit 5d81afb2 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] usb-storage: fix oops

It should fix the OOPS on attach.

This fixes a silly error where I fail to initialize a pointer early enough
for the scanning code.  If this isn't a perfect example of why
scsi_register() and scsi_add_host() aren't two separate functions, I don't
know what is.  :)

Oh, and I added a couple of comments, too.

  -  Fix an OOPS by moving the setting of the hostdata[] pointer to _before_
     the device scan starts.
parent 55d2f9bb
...@@ -926,6 +926,12 @@ static int storage_probe(struct usb_interface *intf, ...@@ -926,6 +926,12 @@ static int storage_probe(struct usb_interface *intf,
goto BadDevice; goto BadDevice;
} }
/* set the hostdata to prepare for scanning */
ss->host->hostdata[0] = (unsigned long)ss;
/* associate this host with our interface */
scsi_set_device(ss->host, &intf->dev);
/* now add the host */ /* now add the host */
result = scsi_add_host(ss->host, NULL); result = scsi_add_host(ss->host, NULL);
if (result) { if (result) {
...@@ -942,9 +948,6 @@ static int storage_probe(struct usb_interface *intf, ...@@ -942,9 +948,6 @@ static int storage_probe(struct usb_interface *intf,
goto BadDevice; goto BadDevice;
} }
ss->host->hostdata[0] = (unsigned long)ss;
scsi_set_device(ss->host, &intf->dev);
printk(KERN_DEBUG printk(KERN_DEBUG
"WARNING: USB Mass Storage data integrity not assured\n"); "WARNING: USB Mass Storage data integrity not assured\n");
printk(KERN_DEBUG printk(KERN_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment