diff options
author | Jyri Sarha <jsarha@ti.com> | 2016-02-23 12:44:27 +0200 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2016-02-25 16:39:47 +0200 |
commit | d0ec32caef0baa490b419895ef61c8481d49f7cd (patch) | |
tree | 692f1536a070894fdf9abef665c9e77c99bc0596 /drivers/gpu/drm/tilcdc/tilcdc_drv.c | |
parent | d66284fba15014daacef64cfc610a249553534c6 (diff) | |
download | op-kernel-dev-d0ec32caef0baa490b419895ef61c8481d49f7cd.zip op-kernel-dev-d0ec32caef0baa490b419895ef61c8481d49f7cd.tar.gz |
drm/tilcdc: Use devm_kzalloc() and devm_kcalloc() for private data
Use devm_kzalloc() and devm_kcalloc() for private data allocation at
driver load time.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc/tilcdc_drv.c')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 41ec890..709bc90 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -143,9 +143,6 @@ static int tilcdc_unload(struct drm_device *dev) pm_runtime_disable(dev->dev); - kfree(priv->saved_register); - kfree(priv); - return 0; } @@ -161,13 +158,12 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) u32 bpp = 0; int ret; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(dev->dev, sizeof(*priv), GFP_KERNEL); if (priv) - priv->saved_register = kcalloc(tilcdc_num_regs(), - sizeof(*priv->saved_register), - GFP_KERNEL); + priv->saved_register = + devm_kcalloc(dev->dev, tilcdc_num_regs(), + sizeof(*priv->saved_register), GFP_KERNEL); if (!priv || !priv->saved_register) { - kfree(priv); dev_err(dev->dev, "failed to allocate private data\n"); return -ENOMEM; } @@ -180,7 +176,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) priv->wq = alloc_ordered_workqueue("tilcdc", 0); if (!priv->wq) { ret = -ENOMEM; - goto fail_free_priv; + goto fail_unset_priv; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -346,10 +342,9 @@ fail_free_wq: flush_workqueue(priv->wq); destroy_workqueue(priv->wq); -fail_free_priv: +fail_unset_priv: dev->dev_private = NULL; - kfree(priv->saved_register); - kfree(priv); + return ret; } |