From: Alan Stern <[EMAIL PROTECTED]>

This patch (as671) fixes a bug in the error pathway for the net2280
probe routine.  A failure during probe will cause the driver to call
pci_get_drvdata before the corresponding pci_set_drvdata has been set.
The patch also does a kzalloc conversion.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---

 drivers/usb/gadget/net2280.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

9fb81ce63671f9743517f628dac935269f2581a9
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index b2d507f..0b92934 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2833,13 +2833,13 @@ static int net2280_probe (struct pci_dev
        }
 
        /* alloc, and start init */
-       dev = kmalloc (sizeof *dev, SLAB_KERNEL);
+       dev = kzalloc (sizeof *dev, SLAB_KERNEL);
        if (dev == NULL){
                retval = -ENOMEM;
                goto done;
        }
 
-       memset (dev, 0, sizeof *dev);
+       pci_set_drvdata (pdev, dev);
        spin_lock_init (&dev->lock);
        dev->pdev = pdev;
        dev->gadget.ops = &net2280_ops;
@@ -2952,7 +2952,6 @@ #endif
        dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff;
 
        /* done */
-       pci_set_drvdata (pdev, dev);
        INFO (dev, "%s\n", driver_desc);
        INFO (dev, "irq %s, pci mem %p, chip rev %04x\n",
                        bufp, base, dev->chiprev);
-- 
1.3.1



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to