From: Markus Elfring Date: Fri, 6 Nov 2015 11:03:46 +0000 (+0100) Subject: UPSTREAM: GPU-DRM: Delete unnecessary checks before drm_property_unreference_blob() X-Git-Tag: release-20171130_firefly~4^2~248 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5dd1f2569f79ff91f1dabb524a2d8f748a7e15b5;p=firefly-linux-kernel-4.4.55.git UPSTREAM: GPU-DRM: Delete unnecessary checks before drm_property_unreference_blob() The drm_property_unreference_blob() function tests whether its argument is NULL and then returns immediately. Thus the tests around the calls are not needed. This issue was detected by using the Coccinelle software. Link: http://patchwork.freedesktop.org/patch/msgid/563C8B3E.405@users.sourceforge.net Signed-off-by: Daniel Vetter (cherry picked from commit 5f911905054a64cf8c7871fddd33f4af74f07a17) Change-Id: I599721227294c7cde5fd4f2ef6d5a97212b61b77 Signed-off-by: Markus Elfring Signed-off-by: Mark Yao --- diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 938d331701a5..fb47e2547df8 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -316,8 +316,7 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0) return 0; - if (state->mode_blob) - drm_property_unreference_blob(state->mode_blob); + drm_property_unreference_blob(state->mode_blob); state->mode_blob = NULL; if (mode) { @@ -363,8 +362,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, if (blob == state->mode_blob) return 0; - if (state->mode_blob) - drm_property_unreference_blob(state->mode_blob); + drm_property_unreference_blob(state->mode_blob); state->mode_blob = NULL; memset(&state->mode, 0, sizeof(state->mode)); @@ -420,8 +418,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, struct drm_property_blob *mode = drm_property_lookup_blob(dev, val); ret = drm_atomic_set_mode_prop_for_crtc(state, mode); - if (mode) - drm_property_unreference_blob(mode); + drm_property_unreference_blob(mode); return ret; } else if (crtc->funcs->atomic_set_property) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d5524917e7c4..3b19a596e7d1 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2367,7 +2367,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); */ void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc) { - if (crtc->state && crtc->state->mode_blob) + if (crtc->state) drm_property_unreference_blob(crtc->state->mode_blob); kfree(crtc->state); crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL); @@ -2435,8 +2435,7 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, struct drm_crtc_state *state) { - if (state->mode_blob) - drm_property_unreference_blob(state->mode_blob); + drm_property_unreference_blob(state->mode_blob); } EXPORT_SYMBOL(__drm_atomic_helper_crtc_destroy_state);