From patchwork Fri May 20 21:35:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gross X-Patchwork-Id: 9130075 X-Patchwork-Delegate: agross@codeaurora.org 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 9546860762 for ; Fri, 20 May 2016 21:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82FB727CC9 for ; Fri, 20 May 2016 21:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7732B27E72; Fri, 20 May 2016 21:35:29 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 4DC5127CC9 for ; Fri, 20 May 2016 21:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751215AbcETVf0 (ORCPT ); Fri, 20 May 2016 17:35:26 -0400 Received: from mail-oi0-f52.google.com ([209.85.218.52]:33941 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065AbcETVf0 (ORCPT ); Fri, 20 May 2016 17:35:26 -0400 Received: by mail-oi0-f52.google.com with SMTP id b65so54852814oia.1 for ; Fri, 20 May 2016 14:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2KhQ+hAjO9xjZ320fTYsqZnLSlEReZo8nRvCCitakmE=; b=bIuvUeyUT1y4+3yq3h9vshxM40i5pu5FMI5XFVjzhhA1Stw6mf/fxxcF1glTsMcFxd Nil6aR8WCZcgCx/kZx+PMeeOeIo2aP2qhDfs/ZVnjxlGhya8dWIQPJgZu/JEd7HGwiwX hLrRWZMvgdApRUH3JBPyW8rHU7XV74G9UVYM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2KhQ+hAjO9xjZ320fTYsqZnLSlEReZo8nRvCCitakmE=; b=hd1TOkzmqt2MeEGfpG2UGFbzER622riGpvsiLOOGDEWbtJi/Iyw6DZI3I3Wl30lPkf 2Rs9mWGbzzs33M0s3I3LC3xKQRG8/dW8MYzRNW+waHwqwffSacbQ4KpujiLa5fDzxJ0j p6y9LuBekOOJms4ChCI2cEjiaHatskXNy/T+gQ+rOFY/azu4Rwv2T/lQnm5cNFPrUXoO 9Dghe1QOUxZqFPzl2oBWcygUnkcBbDmiylJb1kKOiW9b7qf35K3tVj2yG/ctHe7ALK8c /wV6zcFw84qVd0OcMc2xnncle1nP9xCDaDGDhQTL85z8eYUjNFNLRBqDw3RI7mXKHqOj f0vA== X-Gm-Message-State: AOPr4FVmp2IwRw2FbF53B9dbutjn7sV7pj0LYd7sWLpmZtpRfx7kijTREo/jPMOSmgSwtiER X-Received: by 10.202.80.15 with SMTP id e15mr3428465oib.9.1463780124937; Fri, 20 May 2016 14:35:24 -0700 (PDT) Received: from localhost ([2602:306:c558:19b0:c47f:6756:ff9a:fae]) by smtp.gmail.com with ESMTPSA id il4sm6067253obb.3.2016.05.20.14.35.24 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 20 May 2016 14:35:24 -0700 (PDT) From: Andy Gross To: Alan Stern Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, srinivas.kandagatla@linaro.org, Andy Gross Subject: [PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume Date: Fri, 20 May 2016 16:35:07 -0500 Message-Id: <1463780107-12792-1-git-send-email-andy.gross@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes a suspend/resume issue where the driver is blindly calling ehci_suspend/resume functions when the ehci hasn't been setup. This results in a crash during suspend/resume operations. Signed-off-by: Andy Gross Acked-by: Alan Stern Tested-by: Pramod Gurav --- drivers/usb/host/ehci-msm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 3e226ef..9996a60 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev) static int ehci_msm_pm_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); bool do_wakeup = device_may_wakeup(dev); dev_dbg(dev, "ehci-msm PM suspend\n"); - return ehci_suspend(hcd, do_wakeup); + /* Only call ehci_suspend if ehci_setup has been done */ + if (ehci->sbrn) + return ehci_suspend(hcd, do_wakeup); + + return 0; } static int ehci_msm_pm_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); dev_dbg(dev, "ehci-msm PM resume\n"); - ehci_resume(hcd, false); + + /* Only call ehci_resume if ehci_setup has been done */ + if (ehci->sbrn) + ehci_resume(hcd, false); return 0; } + #else #define ehci_msm_pm_suspend NULL #define ehci_msm_pm_resume NULL