Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3086847rwb; Mon, 15 Aug 2022 17:48:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FblKmLDSwJrnLmzOQ5412lENJa03aWJMHppZRWYdFGBJZVphx/dkGr7xFYz/j1O5qcZP2 X-Received: by 2002:a17:907:1c93:b0:730:c9c3:f6f8 with SMTP id nb19-20020a1709071c9300b00730c9c3f6f8mr12415763ejc.17.1660610909975; Mon, 15 Aug 2022 17:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610909; cv=none; d=google.com; s=arc-20160816; b=a14XWPrN8XzOehOet79bwDLb1bWT6EWvPyDB7mIot4kAYFGB8QOVrul7cm8rpMhkXY dD3DevM3mLhUpGOWvZNFIUgw6ipSP9OtXU2dNvS0mrqd+evD7+V/qERt5kp5tgLyo0cp IrNcDP1QA9g6Zkf1AxE0Z2IBXdfeNkkriKe/1XW0tIrt3Id8k4k63Tq+UTeBXtXiULLs Ve+IkqW1hkWtaREXcphpGCpuO0+x43MXDQTtA3AMPMpmHJE4cvuqNM4cXT47wQyZAvFK Uf1nkn90hOz8QFq5K/xcY905h4PIN6NDcywifVbNRC78Ci8x1dipTXu0GHeysFQVVCCI ZByw== 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=yi/bVOF+OxO9rMUx5aXxoCeSflZzLkk5H5Tpbos1cKM=; b=OzQKqsZIkPnww948iiiEFaXoyiQO0CIcHJB3+/ubRKwSbSDyLLVvSBSVSRSI8lwBep 6/60wWx0yw1LqgK5YI3W9mijlzyjZV4lxdmS2hHIlbzFAI6ivN0Dm1s8mVQUcpPxMmH0 LnEFQbKsnEUuLGqqzlKfEFemcxZ1J1pPD9I3g8AbMwa4cGJ4MHMuRWRYD4i6ZoiVZVqS xoHCybWqwllnQbVOwi5R55nMGVQPjZgL0zSku/+rKj+ocCVRM5tYPLEIirbbACNNe3/J Z1EbmZ/AJyiWQUikEzzNIh+wU5kV8U/WdNWVYLSgn1AKQ8U033EU1IHCsovTDJ/xhNXu YToA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mjLHHk5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a1709064a8200b00734c8b99826si9218224eju.803.2022.08.15.17.48.04; Mon, 15 Aug 2022 17:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mjLHHk5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S245398AbiHOWEB (ORCPT + 99 others); Mon, 15 Aug 2022 18:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349705AbiHOWBj (ORCPT ); Mon, 15 Aug 2022 18:01:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 629DD111C2B; Mon, 15 Aug 2022 12:35:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40C16B80EA7; Mon, 15 Aug 2022 19:35:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD04C433C1; Mon, 15 Aug 2022 19:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592155; bh=n8kGDEThAQHhugP3eQZrg2pbr2WIP20ZO2NAN93hyeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjLHHk5dYGxvfkNqxF5SmuzepBOaSMxoDT2Zu72+lae5xPMz+Xbyx8j1UYqwUn3lH wP400IVR27wRslv/r+0Hdhij53U4MrC0o9ioE5I5nlcTG1nP2P35/txsi47e+VIe6C QwsJuf9pvqpjeHqSvzjEFalVxo9OmjVwFpDeS83g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Geert Uytterhoeven , Wolfram Sang , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0742/1095] mmc: renesas_sdhi: Get the reset handle early in the probe Date: Mon, 15 Aug 2022 20:02:21 +0200 Message-Id: <20220815180500.060476774@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad Prabhakar [ Upstream commit 0dac1e498f8130fdacfdd5289e3a7ac87ec1b9ad ] In case of devm_reset_control_get_optional_exclusive() failure we returned directly instead of jumping to the error path to roll back initialization. This patch moves devm_reset_control_get_optional_exclusive() early in the probe so that we have the reset handle prior to initialization of the hardware. Fixes: b4d86f37eacb7 ("mmc: renesas_sdhi: do hard reset if possible") Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Link: https://lore.kernel.org/r/20220624181438.4355-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/renesas_sdhi_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index ddb5ca2f559e..4fb49306275e 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -940,6 +940,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk_cd)) return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock"); + priv->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(priv->rstc)) + return PTR_ERR(priv->rstc); + priv->pinctrl = devm_pinctrl_get(&pdev->dev); if (!IS_ERR(priv->pinctrl)) { priv->pins_default = pinctrl_lookup_state(priv->pinctrl, @@ -1032,10 +1036,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; - priv->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); - if (IS_ERR(priv->rstc)) - return PTR_ERR(priv->rstc); - ver = sd_ctrl_read16(host, CTL_VERSION); /* GEN2_SDR104 is first known SDHI to use 32bit block count */ if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX) -- 2.35.1