diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2019-01-07 20:53:50 +0100 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2019-01-10 09:38:24 +0100 |
commit | f20b187e32e07914ff9878880c7d08ca89b5c3ac (patch) | |
tree | c61cdab4cf7ad32e44b0ce81546c42dd2f8e419d /drivers/pwm | |
parent | 01482d2443db24aa5234f3ffa03b09f03c94f603 (diff) | |
download | linux-f20b187e32e07914ff9878880c7d08ca89b5c3ac.tar.bz2 |
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>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/pwm-imx.c | 10 |
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) 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) |