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: 87415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3417608vqo; Tue, 25 Apr 2023 06:48:09 -0700 (PDT) X-Google-Smtp-Source: AKy350auS7H80xFX+o0dT+VvyzSlkuZnIRpWR2ARiKN0AHY3h1rLUsjnkNHFdsWrr0IiCPkU3AWR X-Received: by 2002:a17:90a:c251:b0:24b:a862:912 with SMTP id d17-20020a17090ac25100b0024ba8620912mr8641592pjx.14.1682430488722; Tue, 25 Apr 2023 06:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682430488; cv=none; d=google.com; s=arc-20160816; b=dCp3w2SgY8mu/cLGnofK8dR1G7R+jsM7+zpddvdxuUL8bYz27zJTFtj1F7LAxwPYn2 WR+Ep6W+PUJleo7Nqp3Jv6BnNST4SIqQjlhaRMEDuhtEtRAUMSCBH4Akbv8BJjif+JBe 81zp2tq4IFLjI/ru+nGL+sAXLxyxhrivYMS9J8L9jY5q0RB7iqQnjyoBkHAT+DN/KNm3 hR+CnR6HG+iDYF6Lc7IXbwquRTnkEtMEk10hlxLyNy1t6vyUZqsy+DDsnjbnlGZ3J48y BTH8e6gT3EckdLUQ9UnH0cXA/TiSMiVR+doeCHnbaVniImnGfckkg1AkvMJ2m/pxbCCZ a5kw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=rXrzLrO3vGjGiwYLBA1OdhCadEqnB23+J7DLeIwxJkU=; b=geTtX02msj7s/yEYsgqI9QvkPN1DSMSmgHS8pjGIBHIE2nU9fCQCpZwtB2RgOSQNTG Bcz/u0HPWlAe7udjOhxJTZBFHakApjwVHuBEwRm1jv+VELoFa/B/PCKDVOHLvZXQSgQO +iy5kaB7iUqPxIAC014FEOxw/hgUgIqxJpi/rWVlYIWqj8ehLhQcd/M3sV9m4zv9/4pd lNCK6SWU1hcukL/ZpxQDiNa063dBl6nZgaw68WFjX1sGDHofHRag9k6gl2q2CzN+02X7 XoqDEpyZiQ5R21bPaf7uB01hINwpfNzo/NFod/SgK8oTIeIIixEp/jc1u2/qrVIvl6aL 8T6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=rPqKGAgt; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a1709029a4200b001a922d1f4c7si13139485plv.60.2023.04.25.06.47.55; Tue, 25 Apr 2023 06:48:08 -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=@wanadoo.fr header.s=t20230301 header.b=rPqKGAgt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234106AbjDYNlc (ORCPT + 99 others); Tue, 25 Apr 2023 09:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbjDYNlb (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 583631A5 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764156232333218915?= X-GMAIL-MSGID: =?utf-8?q?1764156232333218915?= 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; }