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: 9438395 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 C0D3A6047D for ; Sun, 20 Nov 2016 06:34:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEA0428A1E for ; Sun, 20 Nov 2016 06:34:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A4F28BF3; Sun, 20 Nov 2016 06:34:59 +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 316E528B50 for ; Sun, 20 Nov 2016 06:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbcKTGe5 (ORCPT ); Sun, 20 Nov 2016 01:34:57 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34471 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbcKTGe4 (ORCPT ); Sun, 20 Nov 2016 01:34:56 -0500 Received: by mail-pf0-f179.google.com with SMTP id c4so47651273pfb.1 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=l9IFmHHa+hJy++OX7Ll1khbh84RZ/nO8+N41zu0PrXQhb73nWh1MYll2zPcPLj/LXs XcxznWKaS2o5Ja5CBRzo8mpuE+g6LObDttPpNn7jYno6zxzc73sLzc2ainl2NzjGen2t 8LAf+kmemHAA3FX+dAgCroP0UFSo1DEDKx0luBiAKeK9dQ4wbKuAPsUXULNeEnRVwdm0 Y74VeYZGZxbim63a1iYGUj7JWUCHzcDEk6qWxf8QgPflln3o3ftbm77v1Z8dB151BUdo 4TjUlktyX23/zncefEUggolAitHf2K1UYyCxJw7HVP02b4yHP4Qcf+vv5JCzrZQlu7B3 TcWg== X-Gm-Message-State: AKaTC01APW+J3tXkjl0Yal4oP4ahLy/WPbpCaYjhGFOlqytc0cRZwExMmdGP7qvuOZHciU19 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Subhash Jadavani --- drivers/scsi/ufs/ufs-qcom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;