Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3533817pxj; Mon, 24 May 2021 08:50:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2NlbAgYBFJrAW5L3SZaOd3qgsLIoo1QrIeheU32LI4FZ6ncSgkMVink5fFkDilwQYq9Ku X-Received: by 2002:a05:6638:118c:: with SMTP id f12mr10219882jas.143.1621871448486; Mon, 24 May 2021 08:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871448; cv=none; d=google.com; s=arc-20160816; b=F9eR+0NaGxM5yHmP7Zums2KCHh2JDks6OLGV42SZTdNcSZfVjn1KMhSwCclQWAOBu7 nQFagj/MLxl/1C1kR9HGH4AhDsnXps6X3+AGLccab1TRddvVqMaUPQfHScVyJUnWhAPU BE+hSUXibsVwJy0ZX7H7yTYMpulmRvY0R9pBZOFYUnSGu1kCAXyVznirHcu47qsjoClu gg4tbFdcpwN5x032K1XzT4LrELVxQx55C70iyNdkhg7UGarDUFn8zpMfUKeAJtuuDPnP T8H5N0fV1LPU7q5+zs0Tb1ATkZI8CJmI+cYUf/IKYpQJ7j2cdGFvoEI1tItgGtIRBjZ2 eqqA== 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=C7dfSLGwk1J9DK4k7TQllymTYOfnOxGPn5MxT4rmZAI=; b=LkzPy86hv4SYaI0jg3yE5VaayTatNVtkxvLq6aXIz+rLzZYkjM6A3hnfwKl3l1MeOV u4R83kkzUi9eyBhDnbul96CNpScwjXkOyBN6BaDqyC1BMeyzuHzMTS+DyOXZCZo4IOjw pxrcEdoMd3WNgbu0reGvfKW2IwqDH2rPMK8HAYIxpmux04yBcl+d50thgTJ6Fy19djvJ k1uRZ9GHNtgoZEhV7V0qH/zkTlNOSLLD16+kCT0ufOQdn+WloswdIAMDmq0epptWoENa bkZ98qtyjn0W9oG/VFLCrP8ntNgyAp5p8VtWcnBXE5uYoQI0QACkyg2k9euYfjmFbSQK 8D/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WJj72b6n; 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 m12si14404070ild.137.2021.05.24.08.50.34; Mon, 24 May 2021 08:50:48 -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=WJj72b6n; 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 S234060AbhEXPva (ORCPT + 99 others); Mon, 24 May 2021 11:51:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:33922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbhEXPo0 (ORCPT ); Mon, 24 May 2021 11:44:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4A4961477; Mon, 24 May 2021 15:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870558; bh=c8SxYsRbdVuXVwyVy75nz6WNVPnfR4DJEfxVWeSLjlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJj72b6nsCONFsQrInD8syc6cxWY6Z+z52PXFtjcRN1uA/mlCiD7KAZzVhqzw6CZQ z+KW1G0oPS5v5fKPioRgkBlhNMIkWxEja9oTT8tHMZOKbzjHOzOlQ8s+FOtTzBwDj/ VZycKQkkAqNxiU0aek09MeGADT/LWYYAKtYfuHeg= 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 4.19 41/49] scsi: ufs: handle cleanup correctly on devm_reset_control_get error Date: Mon, 24 May 2021 17:25:52 +0200 Message-Id: <20210524152325.695743765@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152324.382084875@linuxfoundation.org> References: <20210524152324.382084875@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 @@ -543,17 +543,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)