From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755501AbaFQGAH (ORCPT ); Tue, 17 Jun 2014 02:00:07 -0400 Received: from mail.windriver.com ([147.11.1.11]:45564 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752160AbaFQGAF (ORCPT ); Tue, 17 Jun 2014 02:00:05 -0400 Message-ID: <539FD94A.8030004@windriver.com> Date: Tue, 17 Jun 2014 13:59:38 +0800 From: "Yang,Wei" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: "Yang,Wei" , , , CC: , , Subject: Re: [PATCH] USB:gadget: Fix a warning while loading g_mass_storage References: <1401856367-12553-1-git-send-email-Wei.Yang@windriver.com> <1402800030-17078-1-git-send-email-Wei.Yang@windriver.com> <539D0817.2080402@windriver.com> In-Reply-To: <539D0817.2080402@windriver.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [128.224.162.170] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/15/2014 10:42 AM, Yang,Wei wrote: > Its v4, sorry for missing it in subject. Alan, How about this version? Cheers Wei > > Regards > Wei > On 06/15/2014 10:40 AM, Wei.Yang@windriver.com wrote: >> From: Yang Wei >> >> While loading g_mass_storage module, the following warning >> is triggered. >> >> WARNING: at drivers/usb/gadget/composite.c: >> usb_composite_setup_continue: Unexpected call >> Modules linked in: fat vfat minix nls_cp437 nls_iso8859_1 g_mass_storage >> [<800179cc>] (unwind_backtrace+0x0/0x104) from [<80619608>] >> (dump_stack+0x20/0x24) >> [<80619608>] (dump_stack+0x20/0x24) from [<80025100>] >> (warn_slowpath_common+0x64/0x74) >> [<80025100>] (warn_slowpath_common+0x64/0x74) from [<800251cc>] >> (warn_slowpath_fmt+0x40/0x48) >> [<800251cc>] (warn_slowpath_fmt+0x40/0x48) from [<7f047774>] >> (usb_composite_setup_continue+0xb4/0xbc [g_mass_storage]) >> [<7f047774>] (usb_composite_setup_continue+0xb4/0xbc >> [g_mass_storage]) from [<7f047ad4>] (handle_exception+0x358/0x3e4 >> [g_mass_storage]) >> [<7f047ad4>] (handle_exception+0x358/0x3e4 [g_mass_storage]) from >> [<7f048080>] (fsg_main_thread+0x520/0x157c [g_mass_storage]) >> [<7f048080>] (fsg_main_thread+0x520/0x157c [g_mass_storage]) from >> [<8004bc90>] (kthread+0x98/0x9c) >> [<8004bc90>] (kthread+0x98/0x9c) from [<8000faec>] >> (kernel_thread_exit+0x0/0x8) >> >> The root cause is that the existing code fails to take into >> account the possibility that common->new_fsg can change while >> do_set_interface() is running, so the value of common->new_fsg >> that gets tested after do_set_interface returns needs to be >> the same as the value used by do_set_interface. >> >> Signed-off-by: Yang Wei >> Acked-by: Alan Stern >> --- >> drivers/usb/gadget/f_mass_storage.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> Changes in v3 ----> v4 >> >> move "new_fsg = common->new_fsg" out of comm->lock protection, and >> refine the commit log. >> >> Thanks >> Wei >> >> diff --git a/drivers/usb/gadget/f_mass_storage.c >> b/drivers/usb/gadget/f_mass_storage.c >> index b963939..a7e24c8 100644 >> --- a/drivers/usb/gadget/f_mass_storage.c >> +++ b/drivers/usb/gadget/f_mass_storage.c >> @@ -2342,6 +2342,7 @@ static void handle_exception(struct fsg_common >> *common) >> struct fsg_buffhd *bh; >> enum fsg_state old_state; >> struct fsg_lun *curlun; >> + struct fsg_dev *new_fsg; >> unsigned int exception_req_tag; >> /* >> @@ -2460,8 +2461,9 @@ static void handle_exception(struct fsg_common >> *common) >> break; >> case FSG_STATE_CONFIG_CHANGE: >> - do_set_interface(common, common->new_fsg); >> - if (common->new_fsg) >> + new_fsg = common->new_fsg; >> + do_set_interface(common, new_fsg); >> + if (new_fsg) >> usb_composite_setup_continue(common->cdev); >> break; > > >