Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2703627pxy; Mon, 3 May 2021 06:17:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1FB1nbaTZc5jb5nXSszBFvxu7kvalFKKhPwhviL7A3/uPyw22y4MVBtU4/LnrXZnKOFbb X-Received: by 2002:a17:90a:e615:: with SMTP id j21mr30766288pjy.43.1620047827809; Mon, 03 May 2021 06:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620047827; cv=none; d=google.com; s=arc-20160816; b=iXpsv1zUhD7ehQwVjRGIDiUmRy6sD926OFOtxyxa4uotRMuJfziQg8t0CWX7+HO5RH lHyGj97j1KE4G3zqLfys7mhOE1/9X2Tsnxh8LrG3lhhzVlR1bfiahtdOjL7WstcNPOuW r1oiEW88v3YkXESFaT9PQ1Djms83KsrKOoNVP4/SqaQyeqNgxcNMyBL40pwp7InN76lC isXrnikjYjdWFWu6TDTRutnr7PVy+kzSRPf/OoxxCxeYy9ncCtMFewUp6KW34zQoQ6N4 YQcp5kxvRqd2qeCOoAmSjB/cRObUTPVhpxyWmSOju9EKQps/IysVKjPS4KKNG/Pr/6IO B6MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XnKQN2yTAkibmWomQqq3BuPinQN0v5P8pXm1cm6UXEo=; b=Ygx+7Fdhuvk4Gm51xq7IqHSkS2iRuQR67AhOSoSyWTaFIEtTR/9FD/z8kfWY5SRwJN vuQDCA6oTfnanM62kCVXWMwbmlDrWqbBr7EktAikGcnE69ey+CkiwD5+YIGQojaz6Zpj ZmKt12MBRZP+NFSpKdfoxrrXvbSQAMVRAWnF+fp2UqMRLqcggjl2nTOAxc/ONg+HAviA gOmV/FxXi2szMLKDEKx8nni88HYsvB6vpUEMV5v73l6ZrzSKQYIXVKf7a5/kNocAXLRo DNbetJYtoQ39zgGBIe4McBJ0VtHCJNZ6GP9oeo8+Ulg8HSlXhrh2d+2pgdNXRV1M9wqo 3Dmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HQFGlRG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si15171929pgo.3.2021.05.03.06.16.55; Mon, 03 May 2021 06:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HQFGlRG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233697AbhECMBF (ORCPT + 99 others); Mon, 3 May 2021 08:01:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:34766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbhECMAj (ORCPT ); Mon, 3 May 2021 08:00:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D43EC6137D; Mon, 3 May 2021 11:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043186; bh=wfsFA25XsbVBnHxmi5OXy/ID3/WfsBshOQDopwQfVBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HQFGlRG+XB02PulDxlV5emqgM/cSH3/R7Jiwa2mydzIiui1sggZYA7e23EmntV6e+ QuqAftgeQX3fBrSd5RsTVHvE9TiMOS70znvfq6ZHUBBE5YFLaUjVf6adLaUo6ZAYaM /sYatmvwaojbcnOqdMT9qWF2zyiCrCa4CKmSrn1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Phillip Potter , Greg Kroah-Hartman , Avri Altman , "Martin K . Petersen" , stable Subject: [PATCH 31/69] scsi: ufs: handle cleanup correctly on devm_reset_control_get error Date: Mon, 3 May 2021 13:56:58 +0200 Message-Id: <20210503115736.2104747-32-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter Move ufshcd_set_variant call in ufs_hisi_init_common to common error section at end of the function, and then jump to this from the error checking statements for both devm_reset_control_get and ufs_hisi_get_resource. This fixes the original commit (63a06181d7ce) which was reverted due to the University of Minnesota problems. Suggested-by: Greg Kroah-Hartman Cc: Avri Altman Cc: Martin K. Petersen Cc: stable Signed-off-by: Phillip Potter Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufs-hisi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c index 7d1e07a9d9dd..d0626773eb38 100644 --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/scsi/ufs/ufs-hisi.c @@ -467,17 +467,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) host->hba = hba; ufshcd_set_variant(hba, host); - host->rst = devm_reset_control_get(dev, "rst"); + host->rst = devm_reset_control_get(dev, "rst"); + if (IS_ERR(host->rst)) { + dev_err(dev, "%s: failed to get reset control\n", __func__); + err = PTR_ERR(host->rst); + goto error; + } ufs_hisi_set_pm_lvl(hba); err = ufs_hisi_get_resource(host); - if (err) { - ufshcd_set_variant(hba, NULL); - return err; - } + if (err) + goto error; return 0; + +error: + ufshcd_set_variant(hba, NULL); + return err; } static int ufs_hi3660_init(struct ufs_hba *hba) -- 2.31.1