Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2927797rwb; Mon, 15 Aug 2022 14:13:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR64JrZQqYF7p1V0qXchy5waTWUOZr3kEwxRsARHb63fZpaUpdDROhSaAK7jwnk+4tBOO9sZ X-Received: by 2002:a05:6a00:21c8:b0:52b:ffc0:15e7 with SMTP id t8-20020a056a0021c800b0052bffc015e7mr18097277pfj.29.1660597996428; Mon, 15 Aug 2022 14:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597996; cv=none; d=google.com; s=arc-20160816; b=gf20VAUVJm9SFQ2hWjmMs6mVEiZPgo208rkjyxPv5r5sHm/+cnwtMVFWaTUo+FynRx pVMc52P0qL5tFsXsa9+IktNUNfHFUx4t2ZTPRt2r1RED6dZcL+Fsc0LeuPBw52vrKIOV vrdfZelDPSPVNrqUPpJlfTcfItexYVRt0E/afMRGyyo5TZIYEfqcma9ZRvoSNZ9hxTD3 euH/ZVMOwgzwAaVHAyjLKEzy0vc9E1awN8c0bdviVb9QQE2l/52p3PExlghS4N0IQm/o O68/+uAp87ZvkX4Qm4jOKPCCOGcNsm0ATvol2aVwqBJWfjm0TgbRGamVqJl+967Lk5cW QQlA== 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=l2Aj6/hXUG5P4SWWCjnDnV8Xm7cmIgduKuk8hHK7+9A=; b=wdSllB2sd2MMTo/seW99ZbWXm3bz36HFAAGHdWGHy7LM0cX/8g9FjB7D4sxnh4ufOY pIC1AIXpXaR3ppP6+YRrzQK/xVtvOgnUWgmNhfldosJxEX3a8q9gbdn/dBXY1c4M8CEF yIJah/I0OgbrmVY9BbJ7ikOkQcpI40ZNHAJyLapsbHH/+iK5XOFMlcF8qU3n+SNUkxOi wdfkS81QUxcOc4LlK8P9FWN/jjVbwdRAlwQZNWMcjZKQ9S7ofLHISmraqbrjXJdgewgq SV49WkpxqqSyrWTTHrmij+nVdZX4a0eM2cPNfnyw/7FMXcDPXpLDgJKtg6y52Txl0jUk 52+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xwty51L+; 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 lb17-20020a17090b4a5100b001f2043193cfsi13405369pjb.124.2022.08.15.14.13.05; Mon, 15 Aug 2022 14:13:16 -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=xwty51L+; 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 S1343886AbiHOTTB (ORCPT + 99 others); Mon, 15 Aug 2022 15:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344319AbiHOTQW (ORCPT ); Mon, 15 Aug 2022 15:16:22 -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 C01CD52DFB; Mon, 15 Aug 2022 11:37:55 -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 DCDC3B81085; Mon, 15 Aug 2022 18:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3DFC433D6; Mon, 15 Aug 2022 18:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588672; bh=6mHqTLvsLe9gEjJsECa4NskXIAM/yP00pb612SforuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwty51L+3TcJnmwUMFzWp5y4HfEyu2Wis/PRfB35jfo4fhdBvG0KMzo+6ZYEXYNNW ldmpLVyiy8uMRuqpI7RoXTZ6w06VYku2A3Uf7yUIFAP5Hu40RlJFDYfIljhO9QGSVV jCMQgT0qqN63J9qw63EnNpIIiFwsArYvvYKXEdew= 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.15 478/779] mmc: renesas_sdhi: Get the reset handle early in the probe Date: Mon, 15 Aug 2022 20:02:02 +0200 Message-Id: <20220815180357.702831259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 ae689bf54686..791e180a0617 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -925,6 +925,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk_cd)) priv->clk_cd = NULL; + 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, @@ -1013,10 +1017,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