Skip to content

Commit 58a42b4

Browse files
Marco Felschgregkh
authored andcommitted
drm/imx: tve: fix regulator_disable error path
[ Upstream commit 7bb58b9 ] 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 <m.felsch@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2cb6880 commit 58a42b4

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

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

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

501+
static void imx_tve_disable_regulator(void *data)
502+
{
503+
struct imx_tve *tve = data;
504+
505+
regulator_disable(tve->dac_reg);
506+
}
507+
501508
static bool imx_tve_readable_reg(struct device *dev, unsigned int reg)
502509
{
503510
return (reg % 4 == 0) && (reg <= 0xdc);
@@ -622,6 +629,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
622629
ret = regulator_enable(tve->dac_reg);
623630
if (ret)
624631
return ret;
632+
ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve);
633+
if (ret)
634+
return ret;
625635
}
626636

627637
tve->clk = devm_clk_get(dev, "tve");
@@ -668,18 +678,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
668678
return 0;
669679
}
670680

671-
static void imx_tve_unbind(struct device *dev, struct device *master,
672-
void *data)
673-
{
674-
struct imx_tve *tve = dev_get_drvdata(dev);
675-
676-
if (!IS_ERR(tve->dac_reg))
677-
regulator_disable(tve->dac_reg);
678-
}
679-
680681
static const struct component_ops imx_tve_ops = {
681682
.bind = imx_tve_bind,
682-
.unbind = imx_tve_unbind,
683683
};
684684

685685
static int imx_tve_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)