diff mbox

GPU-DRM: Delete an unnecessary check before drm_property_unreference_blob()

Message ID 55998CD5.3080204@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring July 5, 2015, 8 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 5 Jul 2015 21:55:10 +0200

The drm_property_unreference_blob() function tests whether its argument
is NULL and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/drm_crtc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

John Hunter July 6, 2015, 2:01 a.m. UTC | #1
On Mon, Jul 6, 2015 at 4:00 AM, SF Markus Elfring <
elfring@users.sourceforge.net> wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 5 Jul 2015 21:55:10 +0200
>
> The drm_property_unreference_blob() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>

Reviewed-by: Zhao Junwang <zhjwpku@gmail.com>

> ---
>  drivers/gpu/drm/drm_crtc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 2d57fc5..6e4c8b0 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -4469,9 +4469,7 @@ static int drm_property_replace_global_blob(struct
> drm_device *dev,
>                         goto err_created;
>         }
>
> -       if (old_blob)
> -               drm_property_unreference_blob(old_blob);
> -
> +       drm_property_unreference_blob(old_blob);
>         *replace = new_blob;
>
>         return 0;
> --
> 2.4.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Daniel Vetter July 6, 2015, 6:53 a.m. UTC | #2
On Mon, Jul 06, 2015 at 10:01:52AM +0800, John Hunter wrote:
> On Mon, Jul 6, 2015 at 4:00 AM, SF Markus Elfring <
> elfring@users.sourceforge.net> wrote:
> 
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Sun, 5 Jul 2015 21:55:10 +0200
> >
> > The drm_property_unreference_blob() function tests whether its argument
> > is NULL and then returns immediately.
> > Thus the test around the call is not needed.
> >
> > This issue was detected by using the Coccinelle software.
> >
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> >
> 
> Reviewed-by: Zhao Junwang <zhjwpku@gmail.com>

Applied to topic/drm-misc, thanks.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 2d57fc5..6e4c8b0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4469,9 +4469,7 @@  static int drm_property_replace_global_blob(struct drm_device *dev,
 			goto err_created;
 	}
 
-	if (old_blob)
-		drm_property_unreference_blob(old_blob);
-
+	drm_property_unreference_blob(old_blob);
 	*replace = new_blob;
 
 	return 0;