Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbbKPOEd (ORCPT ); Mon, 16 Nov 2015 09:04:33 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36458 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbbKPOEa (ORCPT ); Mon, 16 Nov 2015 09:04:30 -0500 Date: Mon, 16 Nov 2015 15:04:25 +0100 From: Daniel Vetter To: SF Markus Elfring Cc: Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Junwang Zhao Subject: Re: [PATCH] GPU-DRM: Delete unnecessary checks before drm_property_unreference_blob() Message-ID: <20151116140425.GS16848@phenom.ffwll.local> Mail-Followup-To: SF Markus Elfring , David Airlie , dri-devel@lists.freedesktop.org, LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Junwang Zhao References: <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <55998CD5.3080204@users.sourceforge.net> <20150706065346.GA2156@phenom.ffwll.local> <563C8B3E.405@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <563C8B3E.405@users.sourceforge.net> X-Operating-System: Linux phenom 4.1.0-2-amd64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3205 Lines: 90 On Fri, Nov 06, 2015 at 12:13:02PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 6 Nov 2015 12:03:46 +0100 > > 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: Markus Elfring Applied to drm-misc, thanks. -Daniel > --- > drivers/gpu/drm/drm_atomic.c | 9 +++------ > drivers/gpu/drm/drm_atomic_helper.c | 5 ++--- > 2 files changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 7bb3845..d65dc31 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; > > if (blob) { > @@ -419,8 +417,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 0c6f621..9870c70 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -2173,7 +2173,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); > @@ -2241,8 +2241,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); > > -- > 2.6.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/