summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/imx/dcss/dcss-scaler.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/imx/dcss/dcss-scaler.c')
-rw-r--r--drivers/gpu/drm/imx/dcss/dcss-scaler.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
index 47852b9dd5..825728c356 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
@@ -302,7 +302,7 @@ static int dcss_scaler_ch_init_all(struct dcss_scaler *scl,
ch->base_ofs = scaler_base + i * 0x400;
- ch->base_reg = ioremap(ch->base_ofs, SZ_4K);
+ ch->base_reg = devm_ioremap(scl->dev, ch->base_ofs, SZ_4K);
if (!ch->base_reg) {
dev_err(scl->dev, "scaler: unable to remap ch base\n");
return -ENOMEM;
@@ -318,7 +318,7 @@ int dcss_scaler_init(struct dcss_dev *dcss, unsigned long scaler_base)
{
struct dcss_scaler *scaler;
- scaler = kzalloc(sizeof(*scaler), GFP_KERNEL);
+ scaler = devm_kzalloc(dcss->dev, sizeof(*scaler), GFP_KERNEL);
if (!scaler)
return -ENOMEM;
@@ -327,18 +327,8 @@ int dcss_scaler_init(struct dcss_dev *dcss, unsigned long scaler_base)
scaler->ctxld = dcss->ctxld;
scaler->ctx_id = CTX_SB_HP;
- if (dcss_scaler_ch_init_all(scaler, scaler_base)) {
- int i;
-
- for (i = 0; i < 3; i++) {
- if (scaler->ch[i].base_reg)
- iounmap(scaler->ch[i].base_reg);
- }
-
- kfree(scaler);
-
+ if (dcss_scaler_ch_init_all(scaler, scaler_base))
return -ENOMEM;
- }
return 0;
}
@@ -351,12 +341,7 @@ void dcss_scaler_exit(struct dcss_scaler *scl)
struct dcss_scaler_ch *ch = &scl->ch[ch_no];
dcss_writel(0, ch->base_reg + DCSS_SCALER_CTRL);
-
- if (ch->base_reg)
- iounmap(ch->base_reg);
}
-
- kfree(scl);
}
void dcss_scaler_ch_enable(struct dcss_scaler *scl, int ch_num, bool en)