From patchwork Fri Nov 18 20:55:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 83028 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp299649qge; Fri, 18 Nov 2016 12:55:52 -0800 (PST) X-Received: by 10.37.17.137 with SMTP id 131mr1035545ybr.56.1479502552929; Fri, 18 Nov 2016 12:55:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c75si2075011ybf.77.2016.11.18.12.55.52; Fri, 18 Nov 2016 12:55:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753242AbcKRUzs (ORCPT + 26 others); Fri, 18 Nov 2016 15:55:48 -0500 Received: from mail-pg0-f53.google.com ([74.125.83.53]:36606 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136AbcKRUzq (ORCPT ); Fri, 18 Nov 2016 15:55:46 -0500 Received: by mail-pg0-f53.google.com with SMTP id f188so106176633pgc.3 for ; Fri, 18 Nov 2016 12:55:46 -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=UADgII5SdWAQB06llgs4wBWctqAK0JADel88erzEIX8=; b=dc18OVVFzgaOfdBy7JhBGzoxD1eXaXzQwmh4XPvmiVVGSicVoEJqEA+QMkHxlEzSH0 w4/j8e12OaFY6VePwWJ3vjy7+NwXKZoWXIV871aO1soRl6AX2m/W19O7OQsmNCZ6i0nB YIkNGBHC3wmPFqAuNSsMDEXMcsnFUgh6qCN4Q= 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=UADgII5SdWAQB06llgs4wBWctqAK0JADel88erzEIX8=; b=VEPDIEYYtvid+12VblAMqFiMHBr1vhRX4s/JiyffhA2JHfsxgpjFUezOhRm9/HR9Pw DNiOeIHI2HKaELl4HZxf2tIlQiYmdBX5MpNB7Al74JMgMQaOyIJ1pWY/uia4nTJwwNbp jt4Pp9eZn1KJB1JnCM/lDu2RG+dqCjuyc441zRrksojQE+zCIf/FptsjXL00QJmctXp6 8e5BciF8XarDOQIXHesYXda9Pk9/Xn9g5/L7vmGG1KfhVq70MpvBV9e5ENShv1wz9HZ6 Mn+barV/TSZfh5F0DEv4cUS5oIkSlPEPYPZiajXdUCn5ydvf9ERdtJTuYFIjt6whuUJG O4WA== X-Gm-Message-State: AKaTC00J016iR62MrpevVERtzRRajWfVMrPv6VG+/F6EwWpRUjWFklIWwwCg7dzNlfwRg5sE X-Received: by 10.99.103.198 with SMTP id b189mr3368965pgc.81.1479502545537; Fri, 18 Nov 2016 12:55:45 -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 t21sm20028330pfa.1.2016.11.18.12.55.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Nov 2016 12:55:44 -0800 (PST) From: Bjorn Andersson To: Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Yaniv Gardi , Vivek Gautam , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH] ufs: qcom: Properly clear hba priv on failure Date: Fri, 18 Nov 2016 12:55:42 -0800 Message-Id: <1479502542-1136-1-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the case where we fail to acquire the phy the hba priv will be set already, so during cleanup ufs_qcom_setup_clocks() will dereference the now free, but still "valid looking" pointer "host". Signed-off-by: Bjorn Andersson --- drivers/scsi/ufs/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.5.0 diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index d345434b084f..7bd88ffee47a 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1197,7 +1197,7 @@ 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_host_free; } err = ufs_qcom_bus_register(host);