Skip to content

Commit 7bb58b9

Browse files
Marco FelschpH5
authored andcommitted
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: fcbc51e ("staging: drm/imx: Add support for Television Encoder (TVEv2)") Signed-off-by: Marco Felsch <[email protected]> Signed-off-by: Philipp Zabel <[email protected]>
1 parent dbd1d67 commit 7bb58b9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/gpu/drm/imx/imx-tve.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve)
490490
return 0;
491491
}
492492

493+
static void imx_tve_disable_regulator(void *data)
494+
{
495+
struct imx_tve *tve = data;
496+
497+
regulator_disable(tve->dac_reg);
498+
}
499+
493500
static bool imx_tve_readable_reg(struct device *dev, unsigned int reg)
494501
{
495502
return (reg % 4 == 0) && (reg <= 0xdc);
@@ -613,6 +620,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
613620
ret = regulator_enable(tve->dac_reg);
614621
if (ret)
615622
return ret;
623+
ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve);
624+
if (ret)
625+
return ret;
616626
}
617627

618628
tve->clk = devm_clk_get(dev, "tve");
@@ -657,18 +667,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
657667
return 0;
658668
}
659669

660-
static void imx_tve_unbind(struct device *dev, struct device *master,
661-
void *data)
662-
{
663-
struct imx_tve *tve = dev_get_drvdata(dev);
664-
665-
if (!IS_ERR(tve->dac_reg))
666-
regulator_disable(tve->dac_reg);
667-
}
668-
669670
static const struct component_ops imx_tve_ops = {
670671
.bind = imx_tve_bind,
671-
.unbind = imx_tve_unbind,
672672
};
673673

674674
static int imx_tve_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)