summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2019-01-07 14:53:50 -0500
committerThierry Reding <thierry.reding@gmail.com>2019-01-10 03:38:24 -0500
commitf20b187e32e07914ff9878880c7d08ca89b5c3ac (patch)
treec61cdab4cf7ad32e44b0ce81546c42dd2f8e419d
parent01482d2443db24aa5234f3ffa03b09f03c94f603 (diff)
pwm: imx: Set driver data earlier simplifying the end of ->probe()
When ->probe() fails the driver core takes care of unsetting the driver data. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r--drivers/pwm/pwm-imx.c10
1 files 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)
390 const struct imx_pwm_data *data; 390 const struct imx_pwm_data *data;
391 struct imx_chip *imx; 391 struct imx_chip *imx;
392 struct resource *r; 392 struct resource *r;
393 int ret = 0;
394 393
395 if (!of_id) 394 if (!of_id)
396 return -ENODEV; 395 return -ENODEV;
@@ -401,6 +400,8 @@ static int imx_pwm_probe(struct platform_device *pdev)
401 if (imx == NULL) 400 if (imx == NULL)
402 return -ENOMEM; 401 return -ENOMEM;
403 402
403 platform_set_drvdata(pdev, imx);
404
404 imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); 405 imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
405 if (IS_ERR(imx->clk_ipg)) { 406 if (IS_ERR(imx->clk_ipg)) {
406 dev_err(&pdev->dev, "getting ipg clock failed with %ld\n", 407 dev_err(&pdev->dev, "getting ipg clock failed with %ld\n",
@@ -431,12 +432,7 @@ static int imx_pwm_probe(struct platform_device *pdev)
431 if (IS_ERR(imx->mmio_base)) 432 if (IS_ERR(imx->mmio_base))
432 return PTR_ERR(imx->mmio_base); 433 return PTR_ERR(imx->mmio_base);
433 434
434 ret = pwmchip_add(&imx->chip); 435 return pwmchip_add(&imx->chip);
435 if (ret < 0)
436 return ret;
437
438 platform_set_drvdata(pdev, imx);
439 return 0;
440} 436}
441 437
442static int imx_pwm_remove(struct platform_device *pdev) 438static int imx_pwm_remove(struct platform_device *pdev)