Re: [PATCH 1/1] usb gadget: modify the handling of function binding return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 01, 2010 at 07:22:35PM +0800, Li, Jiebing wrote:
> From: JiebingLi <jiebing.li@xxxxxxxxx>
> 
> This patch makes the composite gadget more flexible in case that
> any of the functions fails to be bound.
> 
> Signed-off-by: JiebingLi <jiebing.li@xxxxxxxxx>
> ---
>  drivers/usb/gadget/nokia.c |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
> index f1c2647..d99a67c 100644
> --- a/drivers/usb/gadget/nokia.c
> +++ b/drivers/usb/gadget/nokia.c
> @@ -117,35 +117,48 @@ static u8 hostaddr[ETH_ALEN];
>  
>  static int __init nokia_bind_config(struct usb_configuration *c)
>  {
> -	int status = 0;
> +	int	status = 0;
> +	int	ret = -ENODEV;
>  
>  	status = phonet_bind_config(c);
>  	if (status)
>  		printk(KERN_DEBUG "could not bind phonet config\n");
> +	else
> +		ret = 0;

Ick, no, just set ret to 0 at the beginning and then set it to an error
if that happens.

Much smaller patch and easier to read and understand.

Now, are you sure you should be returning -ENODEV for this type of
"warning"?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux