All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: daniel.lezcano@linaro.org
Cc: Anson.Huang@nxp.com, linux-pm@vger.kernel.org,
	Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 2/2] thermal: imx8mm: Disable the clock on probe failure
Date: Wed,  2 Dec 2020 20:24:48 -0300	[thread overview]
Message-ID: <20201202232448.2692-2-festevam@gmail.com> (raw)
In-Reply-To: <20201202232448.2692-1-festevam@gmail.com>

Prior to returning an error in probe, disable the previously
enabled clock.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/thermal/imx8mm_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index ce7cb6452c52..7442e013738f 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -170,7 +170,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev,
 				"failed to register thermal zone sensor[%d]: %d\n",
 				i, ret);
-			return ret;
+			goto disable_clk;
 		}
 		tmu->sensors[i].hw_id = i;
 	}
@@ -185,6 +185,10 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 	imx8mm_tmu_enable(tmu, true);
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(tmu->clk);
+	return ret;
 }
 
 static int imx8mm_tmu_remove(struct platform_device *pdev)
-- 
2.17.1


  reply	other threads:[~2020-12-02 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 23:24 [PATCH 1/2] thermal: imx8mm: Print the correct error code Fabio Estevam
2020-12-02 23:24 ` Fabio Estevam [this message]
2020-12-07 13:47   ` [thermal: thermal/next] thermal: imx8mm: Disable the clock on probe failure thermal-bot for Fabio Estevam
2020-12-07 13:47 ` [thermal: thermal/next] thermal: imx8mm: Print the correct error code thermal-bot for Fabio Estevam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201202232448.2692-2-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=Anson.Huang@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.