Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3084297rwb; Mon, 15 Aug 2022 17:44:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ajaKSm2y16K0OfVpZsr2YztCR4ewQ10XZZFXjzYjjO5HXAOFv4VoApTcN8x4gbfIbB0xs X-Received: by 2002:a05:6402:241e:b0:443:be9:83c0 with SMTP id t30-20020a056402241e00b004430be983c0mr16715995eda.24.1660610678870; Mon, 15 Aug 2022 17:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610678; cv=none; d=google.com; s=arc-20160816; b=D1LJt8TkELLedr4CPZzgfnaqHmbtfOOnBvPNQvNWKNAa6Cbvnz0bInQsIexCqNu4jy qSn1EXVIJPbLwLf3vOgw3t5GkFdmOEKSaiuTEA9383ZnjDbhIqKU6UwpU2ef3O40jZt8 7fMmqY6Is8eXeVwIOlD1kIqKtNdn7F6/LtxxQx6jNH9a+4buporjfdLVnHnB4y+s4EPU OdukxNA0077gkRDbE1SixK9tFT6pk9YuGY7jCsRvH5ndCqaj/hVTdLApUJtRz71W2fWt QwQiRjZyuDQO156XxVWAvvem4aRTtlj3pfNtMEviTmL/bma81OuNs00WF8zzwHXXE0n8 LmUA== 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=CD0isd545alA09C3NdfrPzqVQo3FLT6+L8RYwJjLV5g=; b=e0qxu/GaH4yQcy1tdmNvXMJ/BWHg0M5UhTY7vWhTiTbk7CpTlQnBg7Q3BzS8gRWTr2 RGTdTzKrXhPIt0kz8jX8YCYM9KmkPil7teq0b7FxQ14KevfbcC5EiWMIbJ6C2BfzJ+mr FTx466BeIFWnBQpa1le66B//K41CHkbMfrx8upuxN1UD3FgTigbrCU6yGLlNk4osXm6n 8/br2wcZfzqWjGkETSV9bw3ZoScP0t9VxTLwZkvACMWPMfUFNlCB+kfWKktPUYvm4s8U Uf+ahICgQ7ONSXC5jcLuOBoEwTA1xMyJgsOgKMO4MBJlhF8sJNgeG9CN63oFsbGb6HOQ qQKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ohGWacMA; 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 dn16-20020a17090794d000b00726e777489csi9513892ejc.757.2022.08.15.17.44.13; Mon, 15 Aug 2022 17:44:38 -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=ohGWacMA; 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 S1351118AbiHPA2P (ORCPT + 99 others); Mon, 15 Aug 2022 20:28:15 -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-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 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 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, @@ -1030,10 +1034,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