On Thu, Jul 02 2015, Krzysztof Opasiak wrote:
> According to mass storage specification:
>
> "Logical Unit Numbers on the device shall be numbered contiguously
>  starting from LUN 0 to a maximum LUN of 15 (Fh)"
>
> So let's at least print a warning message that LUNs ids should be
> contiguous.
>
> Signed-off-by: Krzysztof Opasiak <k.opas...@samsung.com>

Acked-by: Michal Nazarewicz <min...@mina86.com>

> ---
>  drivers/usb/gadget/function/f_mass_storage.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
> b/drivers/usb/gadget/function/f_mass_storage.c
> index befe251..08a4fdb 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -3042,6 +3042,12 @@ static int fsg_bind(struct usb_configuration *c, 
> struct usb_function *f)
>               return -EINVAL;
>       }
>  
> +     for (i = 0; i < ARRAY_SIZE(common->luns); ++i)
> +             if (!common->luns[i])
> +                     break;
> +     if (common->max_lun != i - 1)
> +             pr_err("LUN ids should be contiguous.\n");
> +
>       opts = fsg_opts_from_func_inst(f->fi);
>       if (!opts->no_configfs) {
>               ret = fsg_common_set_cdev(fsg->common, c->cdev,
> -- 
> 1.7.9.5
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<m...@google.com>--<xmpp:min...@jabber.org>--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to