diff mbox

[4/5] drm/exynos: Use devm_kzalloc in exynos_drm_hdmi.c file

Message ID 1344235580-3030-5-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat Aug. 6, 2012, 6:46 a.m. UTC
devm_kzalloc is a device managed function and makes freeing and error
handling simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Inki Dae Aug. 8, 2012, 1:09 a.m. UTC | #1
> -----Original Message-----
> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
> Sent: Monday, August 06, 2012 3:46 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki.dae@samsung.com; airlied@linux.ie; sachin.kamat@linaro.org;
> patches@linaro.org
> Subject: [PATCH 4/5] drm/exynos: Use devm_kzalloc in exynos_drm_hdmi.c
> file
> 
> devm_kzalloc is a device managed function and makes freeing and error
> handling simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> index 8ffcdf8..3fdf0b6 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> @@ -345,7 +345,7 @@ static int __devinit exynos_drm_hdmi_probe(struct
> platform_device *pdev)
> 
>  	DRM_DEBUG_KMS("%s\n", __FILE__);
> 
> -	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> +	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
>  	if (!ctx) {
>  		DRM_LOG_KMS("failed to alloc common hdmi context.\n");
>  		return -ENOMEM;
> @@ -371,7 +371,6 @@ static int __devexit exynos_drm_hdmi_remove(struct
> platform_device *pdev)
>  	DRM_DEBUG_KMS("%s\n", __FILE__);
> 
>  	exynos_drm_subdrv_unregister(&ctx->subdrv);
> -	kfree(ctx);
> 
>  	return 0;
>  }
> --
> 1.7.4.1

Applied.

Thanks for your patch.
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 8ffcdf8..3fdf0b6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -345,7 +345,7 @@  static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx) {
 		DRM_LOG_KMS("failed to alloc common hdmi context.\n");
 		return -ENOMEM;
@@ -371,7 +371,6 @@  static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev)
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
 	exynos_drm_subdrv_unregister(&ctx->subdrv);
-	kfree(ctx);
 
 	return 0;
 }