Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3538511pxj; Mon, 24 May 2021 08:57:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrYAdaJw99q28Ms/p4uSu3yhEf5QV1K7A3poGDnfFiL3I9TuoO8JJVr74Mxsq+n6d4FCiu X-Received: by 2002:a6b:e719:: with SMTP id b25mr13770189ioh.49.1621871837991; Mon, 24 May 2021 08:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871837; cv=none; d=google.com; s=arc-20160816; b=NwVWm5W5ofSIH4uV3yPYSBvWcjgVnVQZ6kMQDgw655Rsl48O6QmJ1hwLsGmfFfKFaH HGmGSWPeApKzen4RyeYy8UclVF/gDjBeBWVOJLXK+H3SkQO4OLEJ4i7eL1C/rgOKKRfK glyX3yUtCtBvgNW9ucg66QNAtkd9cbxaBVclfWq6GyOgWWM5hCuWpmsvhLCLkwKzeU7D 7mPNPaaJiDCiMfG3ajxGK1hXb2ssOz0Zoe0idMDXVneGieDQ26RPqTEyjHDovmmFhBNb 0SX6rVGGZ5+Rf5ri5dqjVSLp7HfVvV40bbjO8J256ZzM4YxAmrPYXbJgDeL1VWIPo6kR 8WEw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l/QJif44haGXI0uPPYtszrbcgRUKO4kJBKy+fo5MqLw=; b=YbXjimDnHbkqrUTL8OhjDSYoT2yb7W1yTaz02tv0JJB6A5Fay15TW11O0nL+GZ5VqT 5RN7l+vsVFOx2QwwZ5zLVcLA27GggeeEuQMnC0CE3j9p9e4wzZwDSV0EbV1eKuoGuxPT xbkgpGwJQGvHOfLqjxFmxIlZ3MtneQEQhHoFt4OrhzU53m1AOzYp8N/8RgFPlu7oNvF7 utNXiysupj/1rNARLaIITmSpveoqXesYU5/bSL2qWJ/lWa8dQXrm4m4p1cfdlyTxi+e+ DfzPhpFgyDJ2vyPB5FFnx6ISkmAOrSTLRnBfY94eIDV0SHoootOM878n8EnrVROCeCEM XAFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJCWSQia; 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 g10si15726577ilf.140.2021.05.24.08.57.04; Mon, 24 May 2021 08:57:17 -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=BJCWSQia; 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 S235419AbhEXP57 (ORCPT + 99 others); Mon, 24 May 2021 11:57:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234188AbhEXPvd (ORCPT ); Mon, 24 May 2021 11:51:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 91FDE6162C; Mon, 24 May 2021 15:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870721; bh=MpWRxG7I+/VrDH92dYHO/81/4SPP3cft1Qn8DSyizvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJCWSQiaYA452D3DNsRTrr4MfctE235mmy5rEmho6l1x7AaXYq0k+olus2Jn+fgbz N6VrqpSvbm0COIBzSfBg8cdB6UHBdJCnDOjjv2ES1ft+yQhKZHcRaQUJrrF8cebt08 yX9ATFx3fsY+iD5i2b9uiwxEHUOUA4SDpLicecdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , "Martin K. Petersen" , Phillip Potter Subject: [PATCH 5.4 60/71] scsi: ufs: handle cleanup correctly on devm_reset_control_get error Date: Mon, 24 May 2021 17:26:06 +0200 Message-Id: <20210524152328.403765715@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter commit 2f4a784f40f8d337d6590e2e93f46429052e15ac upstream. 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 Link: https://lore.kernel.org/r/20210503115736.2104747-32-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufs-hisi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/scsi/ufs/ufs-hisi.c @@ -481,17 +481,24 @@ static int ufs_hisi_init_common(struct u 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)