[PATCH] drm/rockchip: Cleanup dangling devm pointers
Sean Paul
seanpaul at chromium.org
Fri Sep 16 11:22:23 PDT 2016
Instead of assigning device managed resources to local variables,
keep track of them in the vop struct.
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 131ae0f..bed782e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -142,6 +142,7 @@ struct vop {
/* vop dclk reset */
struct reset_control *dclk_rst;
+ struct reset_control *ahb_rst;
struct vop_win win[];
};
@@ -1333,7 +1334,6 @@ static int vop_initial(struct vop *vop)
{
const struct vop_data *vop_data = vop->data;
const struct vop_reg_data *init_table = vop_data->init_table;
- struct reset_control *ahb_rst;
int i, ret;
vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
@@ -1374,15 +1374,15 @@ static int vop_initial(struct vop *vop)
/*
* do hclk_reset, reset all vop registers.
*/
- ahb_rst = devm_reset_control_get(vop->dev, "ahb");
- if (IS_ERR(ahb_rst)) {
+ vop->ahb_rst = devm_reset_control_get(vop->dev, "ahb");
+ if (IS_ERR(vop->ahb_rst)) {
dev_err(vop->dev, "failed to get ahb reset\n");
- ret = PTR_ERR(ahb_rst);
+ ret = PTR_ERR(vop->ahb_rst);
goto err_disable_aclk;
}
- reset_control_assert(ahb_rst);
+ reset_control_assert(vop->ahb_rst);
usleep_range(10, 20);
- reset_control_deassert(ahb_rst);
+ reset_control_deassert(vop->ahb_rst);
memcpy(vop->regsbak, vop->regs, vop->len);
--
2.8.0.rc3.226.g39d4020
More information about the Linux-rockchip
mailing list