From nobody Mon Sep 29 21:12:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D2FAC00140 for ; Tue, 16 Aug 2022 00:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350678AbiHPA2R (ORCPT ); Mon, 15 Aug 2022 20:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353226AbiHPAZs (ORCPT ); Mon, 15 Aug 2022 20:25:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6A2832F5; Mon, 15 Aug 2022 13:34:37 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 87E67611E2; Mon, 15 Aug 2022 20:34:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F6EC433C1; Mon, 15 Aug 2022 20:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595640; bh=rKnbmB/cFbBjmzOoHhqLpt0bqmOdR4aC79c5B2XAcUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohGWacMAEjkG4BwGoxyzhMOYoeldGXlpte6SGiu4nXfWMUPcHvru+2mIs06Na3rFA UCaeuHLWDoJMpcmTadLzsbgkFJLGwEIOOlFVoL+rqhWOgBka04ug6Fy31SvVk2/s0B Lhx83hE1gE50ZmeRyIorQZBCdPCM18q8EZOgKHVA= 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.19 0796/1157] mmc: renesas_sdhi: Get the reset handle early in the probe Date: Mon, 15 Aug 2022 20:02:32 +0200 Message-Id: <20220815180511.324137072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/renesa= s_sdhi_core.c index 4404ca1f98d8..0d258b6e1a43 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -938,6 +938,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 c= lock"); =20 + priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); + if (IS_ERR(priv->rstc)) + return PTR_ERR(priv->rstc); + priv->pinctrl =3D devm_pinctrl_get(&pdev->dev); if (!IS_ERR(priv->pinctrl)) { priv->pins_default =3D pinctrl_lookup_state(priv->pinctrl, @@ -1030,10 +1034,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; =20 - priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); - if (IS_ERR(priv->rstc)) - return PTR_ERR(priv->rstc); - ver =3D 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) --=20 2.35.1