From patchwork Thu Mar 8 20:40:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Merlijn Wajer X-Patchwork-Id: 10269201 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 96EFD602BD for ; Thu, 8 Mar 2018 20:41:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86DF729A3A for ; Thu, 8 Mar 2018 20:41:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B72D29B3B; Thu, 8 Mar 2018 20:41:48 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2029929A3A for ; Thu, 8 Mar 2018 20:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231AbeCHUlX (ORCPT ); Thu, 8 Mar 2018 15:41:23 -0500 Received: from nala.villavu.com ([188.165.243.101]:50909 "EHLO nala.villavu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751225AbeCHUlV (ORCPT ); Thu, 8 Mar 2018 15:41:21 -0500 Received: from a82-161-36-93.adsl.xs4all.nl ([82.161.36.93] helo=chrometwo.fritz.box) by nala.villavu.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1eu2Lm-0001D8-Qv; Thu, 08 Mar 2018 21:41:18 +0100 From: Merlijn Wajer To: b-liu@ti.com Cc: merlijn@wizzup.org, ivo.g.dimitrov.75@gmail.com, linux-omap@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: musb: Fix external abort in musb_remove Date: Thu, 8 Mar 2018 21:40:47 +0100 Message-Id: <20180308204049.29474-1-merlijn@wizzup.org> X-Mailer: git-send-email 2.16.2 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes an oops on unbind / module unload. musb_remove function now calls musb_platform_exit before disabling runtime pm. Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e2e95071328a..cf90d34f7199 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2472,13 +2472,14 @@ static int musb_remove(struct platform_device *pdev) musb_platform_disable(musb); spin_lock_irqsave(&musb->lock, flags); musb_disable_interrupts(musb); - musb_writeb(musb->mregs, MUSB_DEVCTL, 0); spin_unlock_irqrestore(&musb->lock, flags); + musb_writeb(musb->mregs, MUSB_DEVCTL, 0); + musb_platform_exit(musb); + pm_runtime_dont_use_autosuspend(musb->controller); pm_runtime_put_sync(musb->controller); pm_runtime_disable(musb->controller); - musb_platform_exit(musb); musb_phy_callback = NULL; if (musb->dma_controller) musb_dma_controller_destroy(musb->dma_controller);