From patchwork Mon Feb 13 19:29:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 9570715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 593DC601E7 for ; Mon, 13 Feb 2017 19:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 492B927F9E for ; Mon, 13 Feb 2017 19:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D01627FA6; Mon, 13 Feb 2017 19:30:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85C8327F9E for ; Mon, 13 Feb 2017 19:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To: Date:References:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HEI7uBfm8veWeLDSl/t8F7Jsi7bKW9u0mkvaEGC5xs8=; b=o2eiHw9xEmRG6s G9VJhroK4M+dwpsG2VHzzvhFjrn6wkQDZvmqsFU2J+I7DfSmYSmADlSU2KmAiLVq0Gv4yPVSXXTUs AISZxNOXU31Ke+qKnZ7LjjVmHecci1pWfw/jOj0IRrZ/Rly82Wrgp6GEE4yU7mUxwgkvGlwNOwM2H dAM65LPG5G0GzDV4/jIkEPM5vmeY8NCeHoYHAcBlshNWH4sRKko3r8jOk/LvwSzwfdX0erSeN+vF7 GbUd78uTqI4v+8hKNwrxt5/g6tCPoicKzCvQbuoeVOtD15JZAG+htjVxnrkWS/9TDyBlP2oTd7KWx PuBQ0+FGVXAv8ho/COzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cdMKF-0004ek-Ph; Mon, 13 Feb 2017 19:30:15 +0000 Received: from smtp02.smtpout.orange.fr ([80.12.242.124] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdMKB-0003Bs-9a for linux-arm-kernel@lists.infradead.org; Mon, 13 Feb 2017 19:30:14 +0000 Received: from belgarion ([92.149.57.213]) by mwinf5d03 with ME id kKVc1u00R4c1gDG03KVcnZ; Mon, 13 Feb 2017 20:29:44 +0100 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Mon, 13 Feb 2017 20:29:44 +0100 X-ME-IP: 92.149.57.213 From: Robert Jarzmik To: Petr Cvek , laurent.pinchart@ideasonboard.com, Felipe Balbi Subject: Re: [BUG] usb: gadget: Kernel oops with UVC USB gadget and configfs References: <497c3c61-31f0-4d40-9bab-5a0aa793e5e9@tul.cz> <87shnt1sue.fsf@belgarion.home> <3faadfcb-5e0d-8f92-3e91-4bd745026644@tul.cz> <8737fj1us3.fsf@belgarion.home> <840f1745-8792-9d7b-9f43-961614b6938d@tul.cz> X-URL: http://belgarath.falguerolles.org/ Date: Mon, 13 Feb 2017 20:29:36 +0100 In-Reply-To: <840f1745-8792-9d7b-9f43-961614b6938d@tul.cz> (Petr Cvek's message of "Mon, 13 Feb 2017 04:04:32 +0100") Message-ID: <87r331zy73.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170213_113011_713352_EAB178BF X-CRM114-Status: GOOD ( 12.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Haojian Zhuang , Daniel Mack Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Petr Cvek writes: > Dne 12.2.2017 v 13:02 Robert Jarzmik napsal(a): > That's weird I even removed pxa_set_udc_info() from magician machine init and it still fails. > Host cable and/or actual camera is not required. It fails without them. > > So you binded pxa27x-udc as UDC controller (= activated it) and then rmmoded > it and nobody complained? No, that usecase actually fails. I think you could submit a proper patch with the diff in [1], with which the pxa27x-udc unloading will work. But it's not _your_ testcase, as per your provided callstack : [ 2152.826529] [] (udc_bind_to_driver [udc_core]) from [] (usb_add_gadget_udc_release+0x138/0x21c [udc_core]) [ 2152.826731] [] (usb_add_gadget_udc_release [udc_core]) from [] (pxa_udc_probe+0x290/0x2fc [pxa27x_udc]) [ 2152.833554] [] (pxa_udc_probe [pxa27x_udc]) from [] (platform_drv_probe+0x38/0x84) [ 2152.833602] [] (platform_drv_probe) from [] (driver_probe_device+0x1e0/0x3f4) Your problem seems in the pxa_udc_probe(), which I would presume you're doing for a second time, ie. after modprobe pxa27x_udc + bind UDC controller + rmmod pxa27x_udc + modprobe pxa27x_udc. I suspect that in this case, the problem is that the rmmod works while udc is still bound to the composite. The lsmod seems to prove that the refcount is still 0 while usb_f_uvc is is bound to pxa27x_udc. [@Felipe and @Laurent] I have no knowledge of usb_f_uvc, so would you tell me if binding usb_f_uvc to pxa27_udc should have incremented the module refcount of pxa27x_udc or not ? > Can you try v4.10? Or send me exact commit on what you tested it so I can test > it too. My top commit (not counting yours) is : 61c04572de40 ("Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux") Cheers. diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 9fb103348b5d..a239eb836652 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2512,7 +2512,8 @@ static int pxa_udc_remove(struct platform_device *_dev) usb_del_gadget_udc(&udc->gadget); pxa_cleanup_debugfs(udc); - usb_put_phy(udc->transceiver); + if (!IS_ERR(udc->transceiver)) + usb_put_phy(udc->transceiver); udc->transceiver = NULL; the_controller = NULL;