diff options
author | Matt Turner <[email protected]> | 2012-09-04 23:33:28 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:50 -0700 |
commit | b6109de34f04747ed2937a2e63c1f53740202d3e (patch) | |
tree | 6578024b65adc9dc2bc3bd4a23cf44f29808b3b2 /src/gallium/state_trackers/egl/drm | |
parent | da3282b6e2f374b88daf09f7f3ba5b05af45f51a (diff) |
Remove useless checks for NULL before freeing
Same as earlier commit, except for "FREE"
This patch has been generated by the following Coccinelle semantic
patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it
@@
expression E;
@@
+ FREE (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
- FREE(E);
(
- E = NULL;
|
- E = 0;
)
...
- }
@@
expression E;
type T;
@@
+ FREE ((T) E);
+ E = NULL;
- if (unlikely (E != NULL)) {
- FREE((T) E);
(
- E = NULL;
|
- E = 0;
)
...
- }
@@
expression E;
@@
+ FREE (E);
- if (unlikely (E != NULL)) {
- FREE (E);
- }
@@
expression E;
type T;
@@
+ FREE ((T) E);
- if (unlikely (E != NULL)) {
- FREE ((T) E);
- }
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/egl/drm')
-rw-r--r-- | src/gallium/state_trackers/egl/drm/modeset.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/drm/native_drm.c | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c index b33323b9d60..32c0a258c6f 100644 --- a/src/gallium/state_trackers/egl/drm/modeset.c +++ b/src/gallium/state_trackers/egl/drm/modeset.c @@ -648,10 +648,8 @@ drm_display_fini_modeset(struct native_display *ndpy) FREE(drmdpy->connectors); } - if (drmdpy->shown_surfaces) { - FREE(drmdpy->shown_surfaces); - drmdpy->shown_surfaces = NULL; - } + FREE(drmdpy->shown_surfaces); + drmdpy->shown_surfaces = NULL; if (drmdpy->saved_crtcs) { for (i = 0; i < drmdpy->resources->count_crtcs; i++) { diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c index feb1dc045bf..23fc137b834 100644 --- a/src/gallium/state_trackers/egl/drm/native_drm.c +++ b/src/gallium/state_trackers/egl/drm/native_drm.c @@ -123,8 +123,7 @@ drm_display_destroy(struct native_display *ndpy) { struct drm_display *drmdpy = drm_display(ndpy); - if (drmdpy->config) - FREE(drmdpy->config); + FREE(drmdpy->config); drm_display_fini_modeset(&drmdpy->base); @@ -132,8 +131,7 @@ drm_display_destroy(struct native_display *ndpy) ndpy->screen = NULL; ndpy_uninit(ndpy); - if (drmdpy->device_name) - FREE(drmdpy->device_name); + FREE(drmdpy->device_name); if (drmdpy->own_gbm) { gbm_device_destroy(&drmdpy->gbmdrm->base.base); |