Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723334 > unrolled thread

[PATCH] drm/gma500: Remove null check before kfree

Started byHimanshu Jha <himanshujha199640@gmail.com>
First post2017-08-30 15:30 +0200
Last post2017-08-31 10:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/gma500:  Remove null check before kfree Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-30 15:30 +0200
    Re: [PATCH] drm/gma500:  Remove null check before kfree Daniel Vetter <daniel@ffwll.ch> - 2017-08-31 10:00 +0200

#1723334 — [PATCH] drm/gma500: Remove null check before kfree

FromHimanshu Jha <himanshujha199640@gmail.com>
Date2017-08-30 15:30 +0200
Subject[PATCH] drm/gma500: Remove null check before kfree
Message-ID<ukbea-oA-29@gated-at.bofh.it>
kfree on NULL pointer is a no-op and therefore checking is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/gpu/drm/gma500/cdv_intel_dp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index c52f9ad..a4bb89b 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -1901,10 +1901,8 @@ cdv_intel_dp_destroy(struct drm_connector *connector)
 
 	if (is_edp(gma_encoder)) {
 	/*	cdv_intel_panel_destroy_backlight(connector->dev); */
-		if (intel_dp->panel_fixed_mode) {
-			kfree(intel_dp->panel_fixed_mode);
-			intel_dp->panel_fixed_mode = NULL;
-		}
+		kfree(intel_dp->panel_fixed_mode);
+		intel_dp->panel_fixed_mode = NULL;
 	}
 	i2c_del_adapter(&intel_dp->adapter);
 	drm_connector_unregister(connector);
-- 
2.7.4

[toc] | [next] | [standalone]


#1723944

FromDaniel Vetter <daniel@ffwll.ch>
Date2017-08-31 10:00 +0200
Message-ID<uksyl-2Q9-5@gated-at.bofh.it>
In reply to#1723334
On Wed, Aug 30, 2017 at 06:55:56PM +0530, Himanshu Jha wrote:
> kfree on NULL pointer is a no-op and therefore checking is redundant.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

Applied to drm-misc-next, thanks.
-Daniel

> ---
>  drivers/gpu/drm/gma500/cdv_intel_dp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> index c52f9ad..a4bb89b 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> @@ -1901,10 +1901,8 @@ cdv_intel_dp_destroy(struct drm_connector *connector)
>  
>  	if (is_edp(gma_encoder)) {
>  	/*	cdv_intel_panel_destroy_backlight(connector->dev); */
> -		if (intel_dp->panel_fixed_mode) {
> -			kfree(intel_dp->panel_fixed_mode);
> -			intel_dp->panel_fixed_mode = NULL;
> -		}
> +		kfree(intel_dp->panel_fixed_mode);
> +		intel_dp->panel_fixed_mode = NULL;
>  	}
>  	i2c_del_adapter(&intel_dp->adapter);
>  	drm_connector_unregister(connector);
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web