Commit 5f911905 authored by Markus Elfring's avatar Markus Elfring Committed by Daniel Vetter

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.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Link: http://patchwork.freedesktop.org/patch/msgid/563C8B3E.405@users.sourceforge.netSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 36af4ca7
...@@ -316,8 +316,7 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, ...@@ -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) if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
return 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; state->mode_blob = NULL;
if (mode) { if (mode) {
...@@ -363,8 +362,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, ...@@ -363,8 +362,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
if (blob == state->mode_blob) if (blob == state->mode_blob)
return 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; state->mode_blob = NULL;
if (blob) { if (blob) {
...@@ -419,8 +417,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, ...@@ -419,8 +417,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
struct drm_property_blob *mode = struct drm_property_blob *mode =
drm_property_lookup_blob(dev, val); drm_property_lookup_blob(dev, val);
ret = drm_atomic_set_mode_prop_for_crtc(state, mode); ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
if (mode) drm_property_unreference_blob(mode);
drm_property_unreference_blob(mode);
return ret; return ret;
} }
else if (crtc->funcs->atomic_set_property) else if (crtc->funcs->atomic_set_property)
......
...@@ -2184,7 +2184,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); ...@@ -2184,7 +2184,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
*/ */
void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc) 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); drm_property_unreference_blob(crtc->state->mode_blob);
kfree(crtc->state); kfree(crtc->state);
crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL); crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
...@@ -2252,8 +2252,7 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); ...@@ -2252,8 +2252,7 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state);
void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
struct drm_crtc_state *state) 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); EXPORT_SYMBOL(__drm_atomic_helper_crtc_destroy_state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment