On Sat, 19 Aug 2006, Peter Oehry wrote:

> There is one small question left.
> 
> What shall we return in the usb_driver_set_configuration when the 
> schedule_work() returns zero? I belive it should be a negative number. But 
> which error code would be appropriate?
> 
>       rc = schedule_work(&req->work); /* returns 0 on error - 1 if successful 
> */
>       if (!rc) {
>               usb_put_dev(udev);
>               kfree(req);
>               return ???? /* << which return would be appropriate? */
>       }
>       return 0; /* << I've replace return rc by return 0 */

Here's the version I will submit:

int usb_driver_set_configuration(struct usb_device *udev, int config)
{
        struct set_config_request *req;

        req = kmalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return -ENOMEM;
        req->udev = udev;
        req->config = config;
        INIT_WORK(&req->work, driver_set_config_work, req);

        usb_get_dev(udev);
        if (!schedule_work(&req->work)) {
                usb_put_dev(udev);
                kfree(req);
                return -EINVAL;
        }
        return 0;
}

Alan Stern


-------------------------------------------------------------------------
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