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: 9437391 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 3538B60755 for ; Fri, 18 Nov 2016 20:55:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2439C29A22 for ; Fri, 18 Nov 2016 20:55:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15E3E29A27; Fri, 18 Nov 2016 20:55:56 +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 A61A329A23 for ; Fri, 18 Nov 2016 20:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753219AbcKRUzs (ORCPT ); Fri, 18 Nov 2016 15:55:48 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:33407 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752837AbcKRUzq (ORCPT ); Fri, 18 Nov 2016 15:55:46 -0500 Received: by mail-pg0-f51.google.com with SMTP id 3so106603586pgd.0 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=gvWs218GO8NIyU66fwBA2CwCaL/DHeTeNHaXTYUaPt8I+fvjapt1uNyCWRJv895fEz 2t6I34oR8q5+XB463DTefJnNuQ/EKmBv5dEtMqdU6DVjy4/6HBzEToNXcQswilNipAuy uwKGQcwr3z44e6fzHQqEP9ZSIoFcZEn2kmQ2MjNyTCo++7vpAapTdOmxL7y1lkX/shJp Uocrrjsphyv6p6RqP6x/M3n5SU9/mslf0Q/3ABm3xWduZYeCB//vyl0YbL1jJhHwXkQx 192jJyMV7lDkYJo/00/Oh8vl0Xr+VUgtrnV5DD5BSkXfQBi8tCmtlOjiOnUd4rHbA8he VpKQ== X-Gm-Message-State: AKaTC00WtB8jjgZcYXdr377qUTCe2bu2/Tbn6ZRSvFTMb1eyXalHy9LMr1t0YT6pFK9o239C 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);