Commit 7bb58b98 authored by Marco Felsch's avatar Marco Felsch Committed by Philipp Zabel

drm/imx: tve: fix regulator_disable error path

Add missing regulator_disable() as devm_action to avoid dedicated
unbind() callback and fix the missing error handling.

Fixes: fcbc51e5 ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Signed-off-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent dbd1d67d
...@@ -490,6 +490,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) ...@@ -490,6 +490,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve)
return 0; return 0;
} }
static void imx_tve_disable_regulator(void *data)
{
struct imx_tve *tve = data;
regulator_disable(tve->dac_reg);
}
static bool imx_tve_readable_reg(struct device *dev, unsigned int reg) static bool imx_tve_readable_reg(struct device *dev, unsigned int reg)
{ {
return (reg % 4 == 0) && (reg <= 0xdc); return (reg % 4 == 0) && (reg <= 0xdc);
...@@ -613,6 +620,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) ...@@ -613,6 +620,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
ret = regulator_enable(tve->dac_reg); ret = regulator_enable(tve->dac_reg);
if (ret) if (ret)
return ret; return ret;
ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve);
if (ret)
return ret;
} }
tve->clk = devm_clk_get(dev, "tve"); tve->clk = devm_clk_get(dev, "tve");
...@@ -657,18 +667,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) ...@@ -657,18 +667,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
} }
static void imx_tve_unbind(struct device *dev, struct device *master,
void *data)
{
struct imx_tve *tve = dev_get_drvdata(dev);
if (!IS_ERR(tve->dac_reg))
regulator_disable(tve->dac_reg);
}
static const struct component_ops imx_tve_ops = { static const struct component_ops imx_tve_ops = {
.bind = imx_tve_bind, .bind = imx_tve_bind,
.unbind = imx_tve_unbind,
}; };
static int imx_tve_probe(struct platform_device *pdev) static int imx_tve_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment