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: 68305 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp106089qge; Fri, 20 May 2016 14:35:28 -0700 (PDT) X-Received: by 10.98.67.7 with SMTP id q7mr8126119pfa.70.1463780128659; Fri, 20 May 2016 14:35:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk1si30473959pac.100.2016.05.20.14.35.28; Fri, 20 May 2016 14:35:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751215AbcETVf0 (ORCPT + 8 others); 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 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 --- drivers/usb/host/ehci-msm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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