From patchwork Sun Nov 20 06:34:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 83142 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp882866qge; Sat, 19 Nov 2016 22:35:01 -0800 (PST) X-Received: by 10.13.193.4 with SMTP id c4mr8535640ywd.104.1479623701092; Sat, 19 Nov 2016 22:35:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x63si3367864ywc.385.2016.11.19.22.34.58; Sat, 19 Nov 2016 22:35:01 -0800 (PST) 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 S1752318AbcKTGe4 (ORCPT + 9 others); Sun, 20 Nov 2016 01:34:56 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35256 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbcKTGe4 (ORCPT ); Sun, 20 Nov 2016 01:34:56 -0500 Received: by mail-pf0-f170.google.com with SMTP id i88so59418228pfk.2 for ; Sat, 19 Nov 2016 22:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=h3ZHuI8CiKohq2dlqUcm3Hlb151yMBoXTpCEjEbXsUA=; b=fEzCEzqJ6uZlrm33VDPfWqAoHHEwtD0Jv1IYW/fIqpwPfkFXTJSmFQqQABtKHbzMDX mQnUkvgUSZIwi+UHzqRwygS01fwW+vnjx/Nd/qHyxJlZTdNHRHhnD6hIN/86Q9kIpxuH EH32lDuLC0KkIbYbTWCbSIZCC6C7lK1DcHGmI= 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=h3ZHuI8CiKohq2dlqUcm3Hlb151yMBoXTpCEjEbXsUA=; b=kSmzB9oFGAN6wKn89xi8Jz9ZAprqXRVIphfZb+hniv5Nb2IwROU0FqHaoDuJLxpInh tDrW2VrSpRduCJu613tsrTckEkvdQ3RbWvSbHaUHt8XDvEzSVr+XVazjysqWdwJzlhSp KzKuHD/9GBjKlDevHvEKkf8AVQdh6xvBMPidGRz7MVMiV6Y3J+wkUf2Cx77UNin2ZW5H mG7hm+8rrf9RgvMdMh2uNv4GfxsO07e5k/lltC75UaJi4O+cg2lO3crfRA3ffg2LHCqG we7DmrGt0GWBbRt/b9McEfY1VbmID3F2TVM+Ywjd2DaGBRhyLScTWTl54CMl8Rum6DEd 1wSw== X-Gm-Message-State: AKaTC02rEdPltUqc90/LSsrgdxJJo6ICAEDbvdTgsUhDwE/hwge34OlbGy8ss2nWf1zCp3nY X-Received: by 10.98.31.14 with SMTP id f14mr10017781pff.27.1479623695152; Sat, 19 Nov 2016 22:34:55 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id w5sm28573960pfl.31.2016.11.19.22.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 19 Nov 2016 22:34:54 -0800 (PST) From: Bjorn Andersson To: Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" , Subhash Jadavani Cc: Yaniv Gardi , Vivek Gautam , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2] ufs: qcom: Properly clear hba priv on failure Date: Sat, 19 Nov 2016 22:34:51 -0800 Message-Id: <1479623691-7612-1-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org ufs_qcom_init() sets the hba priv data before attempting to acquire the phy handle, so make sure to clear this in the case of an error. Failing to do this will make ufs_qcom_setup_clocks() operate on the uninitalized host object. Signed-off-by: Bjorn Andersson --- drivers/scsi/ufs/ufs-qcom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.5.0 -- 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 Reviewed-by: Subhash Jadavani diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index d345434b084f..4de372d271b0 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1197,12 +1197,12 @@ static int ufs_qcom_init(struct ufs_hba *hba) if (IS_ERR(host->generic_phy)) { err = PTR_ERR(host->generic_phy); dev_err(dev, "%s: PHY get failed %d\n", __func__, err); - goto out; + goto out_variant_clear; } err = ufs_qcom_bus_register(host); if (err) - goto out_host_free; + goto out_variant_clear; ufs_qcom_get_controller_revision(hba, &host->hw_ver.major, &host->hw_ver.minor, &host->hw_ver.step); @@ -1267,7 +1267,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) phy_power_off(host->generic_phy); out_unregister_bus: phy_exit(host->generic_phy); -out_host_free: +out_variant_clear: ufshcd_set_variant(hba, NULL); out: return err;