On Fri, 2019-07-05 at 10:49 +0000, EJ Hsu wrote: > The change for my previous patch is as follows, and it works well on my local test. > > Thanks, > EJ > > diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c > index 982c3e8..b5f1e1e 100644 > --- a/drivers/usb/gadget/function/f_mass_storage.c > +++ b/drivers/usb/gadget/function/f_mass_storage.c > @@ -2306,7 +2306,6 @@ static void handle_exception(struct fsg_common *common) > enum fsg_state old_state; > struct fsg_lun *curlun; > unsigned int exception_req_tag; > - struct fsg_dev *fsg; > > /* > * Clear the existing signals. Anything but SIGUSR1 is converted > @@ -2413,15 +2412,9 @@ static void handle_exception(struct fsg_common *common) > break; > > case FSG_STATE_CONFIG_CHANGE: > - fsg = common->new_fsg; > - /* > - * Add a check here to double confirm if a disconnect event > - * occurs and common->new_fsg has been cleared. > - */ > - if (fsg) { > - do_set_interface(common, fsg); > + do_set_interface(common, common->new_fsg); > + if (common->new_fsg) > usb_composite_setup_continue(common->cdev); > - } > break; > > case FSG_STATE_DISCONNECT: > diff --git a/drivers/usb/gadget/function/storage_common.h b/drivers/usb/gadget/function/storage_common.h > index 12687f7..fc13921 100644 > --- a/drivers/usb/gadget/function/storage_common.h > +++ b/drivers/usb/gadget/function/storage_common.h > @@ -160,8 +160,8 @@ enum fsg_state { > FSG_STATE_NORMAL, > FSG_STATE_ABORT_BULK_OUT, > FSG_STATE_PROTOCOL_RESET, > - FSG_STATE_CONFIG_CHANGE, > FSG_STATE_DISCONNECT, > + FSG_STATE_CONFIG_CHANGE, > FSG_STATE_EXIT, > FSG_STATE_TERMINATED > }; Is this patch against some other patch ? Please send the whole thing so people don't have to go digging in archives to figure what the code looks like. The above by itself doesn't make sense and can't be reviewed. However, I have a strong suspicion that if you still need to test new_fsg before calling usb_composite_setup_continue(). Then you haven't fixed the bug that I describe. Cheers, Ben.