linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 2/4] pwm: imx: set drvdata earlier simplifying the end of .probe
Date: Mon,  7 Jan 2019 20:53:50 +0100	[thread overview]
Message-ID: <20190107195352.3149-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20190107195352.3149-1-u.kleine-koenig@pengutronix.de>

When .probe fails the driver core cares about unsetting drvdata again.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-imx.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 1e90d2b78625..809493d86d22 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -390,7 +390,6 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	const struct imx_pwm_data *data;
 	struct imx_chip *imx;
 	struct resource *r;
-	int ret = 0;
 
 	if (!of_id)
 		return -ENODEV;
@@ -401,6 +400,8 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	if (imx == NULL)
 		return -ENOMEM;
 
+	platform_set_drvdata(pdev, imx);
+
 	imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(imx->clk_ipg)) {
 		dev_err(&pdev->dev, "getting ipg clock failed with %ld\n",
@@ -431,12 +432,7 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(imx->mmio_base))
 		return PTR_ERR(imx->mmio_base);
 
-	ret = pwmchip_add(&imx->chip);
-	if (ret < 0)
-		return ret;
-
-	platform_set_drvdata(pdev, imx);
-	return 0;
+	return pwmchip_add(&imx->chip);
 }
 
 static int imx_pwm_remove(struct platform_device *pdev)
-- 
2.20.1

  parent reply	other threads:[~2019-01-07 19:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 19:53 [PATCH 0/4] pwm: imx: some cleanup patches Uwe Kleine-König
2019-01-07 19:53 ` [PATCH 1/4] pwm: imx: remove if block where the condition is always wrong Uwe Kleine-König
2019-01-07 19:53 ` Uwe Kleine-König [this message]
2019-01-07 19:53 ` [PATCH 3/4] pwm: imx: don't print an error on -EPROBE_DEFER Uwe Kleine-König
2019-01-07 19:53 ` [PATCH 4/4] pwm: imx: split into two drivers Uwe Kleine-König
2019-01-10 20:19   ` [PATCH 0/2] ARM: adapt defconfigs to pwm driver split Uwe Kleine-König
2019-01-10 20:19     ` [PATCH 1/2] ARM: imx_v6_v7_defconfig: continue compiling the pwm driver Uwe Kleine-König
2019-01-10 20:19     ` [PATCH 2/2] ARM: imx_v4_v5_defconfig: enable PWM driver Uwe Kleine-König
2019-03-22  1:57     ` [PATCH 0/2] ARM: adapt defconfigs to pwm driver split Shawn Guo
2019-01-10 10:07 ` [PATCH 0/4] pwm: imx: some cleanup patches Thierry Reding
  -- strict thread matches above, loose matches on Subject: below --
2018-11-19 19:58 [PATCH 1/4] pwm: imx: remove if block where the condition is always wrong Uwe Kleine-König
2018-11-19 19:58 ` [PATCH 2/4] pwm: imx: set drvdata earlier simplifying the end of .probe Uwe Kleine-König

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=20190107195352.3149-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).