On Fri, 3 Aug 2007, Inaky Perez-Gonzalez wrote: > +static > +void usb_dev_reset_delayed_task(struct work_struct *ws) > +{ > + struct usb_dev_reset_ctx *reset_ctx = > + container_of(ws, struct usb_dev_reset_ctx, ws); > + struct usb_device *usb_dev = reset_ctx->usb_dev; > + struct device *dev = &usb_dev->dev; > + int had_to_lock; > + int result = 0; > + > + if (usb_dev == NULL) { > + WARN_ON(1); > + goto release; > + }
This can never happen; there's no reason to test for it. > +void usb_dev_reset_delayed(struct usb_device *usb_dev) > +{ > + struct usb_dev_reset_ctx *reset_ctx; > + struct device *dev = &usb_dev->dev; > + reset_ctx = kmalloc(sizeof(*reset_ctx), GFP_ATOMIC); > + if (reset_ctx == NULL) { > + if (printk_ratelimit()) > + dev_err(dev, "USB: cannot allocate memory for " > + "delayed device reset\n"); > + return; > + } > + if (try_module_get(THIS_MODULE) == 0) > + goto error_module_get; > + usb_get_dev(usb_dev); > + if (usb_dev->delayed_reset) > + goto error_pending; > + usb_dev->delayed_reset = 1; > + reset_ctx->usb_dev = usb_dev; > + INIT_WORK(&reset_ctx->ws, usb_dev_reset_delayed_task); > + schedule_work(&reset_ctx->ws); > + return; > + > +error_pending: > + usb_put_dev(usb_dev); You forgot to call module_put(). > +error_module_get: > + kfree(reset_ctx); > + return; > +} > +EXPORT_SYMBOL_GPL(usb_dev_reset_delayed); Alan Stern ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel