From patchwork Tue Apr 25 13:41:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 677072 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 A591AC77B61 for ; Tue, 25 Apr 2023 13:41:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233452AbjDYNlb (ORCPT ); Tue, 25 Apr 2023 09:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjDYNlb (ORCPT ); Tue, 25 Apr 2023 09:41:31 -0400 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580D6FF for ; Tue, 25 Apr 2023 06:41:30 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id rIv9pfJUpNW2mrIv9pVpBo; Tue, 25 Apr 2023 15:41:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682430088; bh=rXrzLrO3vGjGiwYLBA1OdhCadEqnB23+J7DLeIwxJkU=; h=From:To:Cc:Subject:Date; b=rPqKGAgtC97DC+4ysW4ox64hT/KD/gHMevtma70trjnkFd1NqMVAogdG1plzShqgQ pSYo24zJia4wYKcxJa9ZCBA8SYnbuYKiy5bptaRtpOSxK1ZP9zKPL7FWToeSsIWR/9 vlnV41mZ4tT9AhtPvUrHUkEUodsqqQ7tsraISuACtctXk8Fa2d3fNe4Muj3HIc3Kq7 1Ujzxaq9ARCLrKsqNVIeom7pXugqo9pVvCKyWsgvPqo669tqd4aiwUVZem3myMnTr4 DGV3ccRiGUPsy+7hkw2CkgbjjYK0C0fl78AMX2nvJNfujPCK7veZ2XV/2Nu8TkbsYe dis3Zm/LCSWkw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 25 Apr 2023 15:41:28 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Adrian Hunter , Ulf Hansson , Philipp Zabel , Brad Larson Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mmc@vger.kernel.org Subject: [PATCH] mmc: sdhci-cadence: Fix an error handling path in sdhci_cdns_probe() Date: Tue, 25 Apr 2023 15:41:26 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org If devm_reset_control_get_optional_exclusive() fails, some resources still need to be released. So branch to the error handling path instead of returning directly. Fixes: aad53d4ee756 ("mmc: sdhci-cadence: Support mmc hardware reset") Signed-off-by: Christophe JAILLET Acked-by: Adrian Hunter Acked-by: Brad Larson --- drivers/mmc/host/sdhci-cadence.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index b24aa27da50c..d2f625054689 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -540,9 +540,11 @@ static int sdhci_cdns_probe(struct platform_device *pdev) if (host->mmc->caps & MMC_CAP_HW_RESET) { priv->rst_hw = devm_reset_control_get_optional_exclusive(dev, NULL); - if (IS_ERR(priv->rst_hw)) - return dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw), - "reset controller error\n"); + if (IS_ERR(priv->rst_hw)) { + ret = dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw), + "reset controller error\n"); + goto free; + } if (priv->rst_hw) host->mmc_host_ops.card_hw_reset = sdhci_cdns_mmc_hw_reset; }