From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com ([209.85.212.177]:34639 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754581AbbGBT3h convert rfc822-to-8bit (ORCPT ); Thu, 2 Jul 2015 15:29:37 -0400 Received: by wiar9 with SMTP id r9so110948712wia.1 for ; Thu, 02 Jul 2015 12:29:36 -0700 (PDT) From: Michal Nazarewicz To: Krzysztof Opasiak , balbi@ti.com Cc: stable@vger.kernel.org, david.fisher1@synopsys.com, gregkh@linuxfoundation.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, linux-usb@vger.kernel.org, Krzysztof Opasiak Subject: Re: [PATCH v2 5/5] usb: gadget: mass_storage: Warn if LUNs ids are not contiguous In-Reply-To: <1435863398-24646-6-git-send-email-k.opasiak@samsung.com> References: <1435863398-24646-1-git-send-email-k.opasiak@samsung.com> <1435863398-24646-6-git-send-email-k.opasiak@samsung.com> Date: Thu, 02 Jul 2015 21:29:33 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: stable-owner@vger.kernel.org List-ID: 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 Acked-by: Michal Nazarewicz > --- > 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 +------ooO--(_)--Ooo--