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>
This commit is contained in:
Родитель
01482d2443
Коммит
f20b187e32
|
@ -390,7 +390,6 @@ static int imx_pwm_probe(struct platform_device *pdev)
|
||||||
const struct imx_pwm_data *data;
|
const struct imx_pwm_data *data;
|
||||||
struct imx_chip *imx;
|
struct imx_chip *imx;
|
||||||
struct resource *r;
|
struct resource *r;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (!of_id)
|
if (!of_id)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -401,6 +400,8 @@ static int imx_pwm_probe(struct platform_device *pdev)
|
||||||
if (imx == NULL)
|
if (imx == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, imx);
|
||||||
|
|
||||||
imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
||||||
if (IS_ERR(imx->clk_ipg)) {
|
if (IS_ERR(imx->clk_ipg)) {
|
||||||
dev_err(&pdev->dev, "getting ipg clock failed with %ld\n",
|
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))
|
if (IS_ERR(imx->mmio_base))
|
||||||
return PTR_ERR(imx->mmio_base);
|
return PTR_ERR(imx->mmio_base);
|
||||||
|
|
||||||
ret = pwmchip_add(&imx->chip);
|
return pwmchip_add(&imx->chip);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, imx);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_pwm_remove(struct platform_device *pdev)
|
static int imx_pwm_remove(struct platform_device *pdev)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче