[PATCH 2/4] usbgadget: do not register when no functions present

Oleksij Rempel ore at pengutronix.de
Fri Sep 29 06:05:14 PDT 2017


On Wed, Sep 27, 2017 at 11:12:43AM +0200, Sascha Hauer wrote:
> registering a multifunction device makes only sense when there's
> at least one function configured. Just return otherwise.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  drivers/usb/gadget/autostart.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
> index 3fa43137fa..a27be899c3 100644
> --- a/drivers/usb/gadget/autostart.c
> +++ b/drivers/usb/gadget/autostart.c
> @@ -55,6 +55,10 @@ static int usbgadget_autostart(void)
>  
>  	opts->create_acm = acm;
>  
> +	if (!opts->fastboot_opts.files && !opts->create_acm) {
> +		pr_warn("No functions to register\n");
> +		return 0;
> +	}
>  
>  	ret = usb_multi_register(opts);
>  	if (ret)
> -- 
> 2.11.0
> 
> 

Reviewed-by: Oleksij Rempel <o.rempel at pengutronix.de>

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list