diff mbox

[1/1] GPU-DRM-MSM: Deletion of unnecessary checks before two function calls

Message ID 54748541.4000600@users.sourceforge.net (mailing list archive)
State Accepted
Headers show

Commit Message

SF Markus Elfring Nov. 25, 2014, 1:33 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Nov 2014 14:30:28 +0100

The functions framebuffer_release() and vunmap() perform also input
parameter validation. 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/msm/msm_fbdev.c | 3 +--
 drivers/gpu/drm/msm/msm_gem.c   | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Thierry Reding Dec. 1, 2014, 4:04 p.m. UTC | #1
On Tue, Nov 25, 2014 at 02:33:53PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Nov 2014 14:30:28 +0100
> 
> The functions framebuffer_release() and vunmap() perform also input
> parameter validation. 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/msm/msm_fbdev.c | 3 +--
>  drivers/gpu/drm/msm/msm_gem.c   | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)

This needs the same fix for the subject prefix that I mentioned for your
other patch, otherwise:

Reviewed-by: Thierry Reding <treding@nvidia.com>

Perhaps a good idea would be to send all of these patches with the
subject prefix fixed up as a second version and threaded in a series.
That makes it easier for people to pick them up (assuming Dave will take
them directly).

Thierry
Rob Clark Dec. 1, 2014, 4:09 p.m. UTC | #2
On Mon, Dec 1, 2014 at 11:04 AM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> On Tue, Nov 25, 2014 at 02:33:53PM +0100, SF Markus Elfring wrote:
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Tue, 25 Nov 2014 14:30:28 +0100
>>
>> The functions framebuffer_release() and vunmap() perform also input
>> parameter validation. 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/msm/msm_fbdev.c | 3 +--
>>  drivers/gpu/drm/msm/msm_gem.c   | 3 +--
>>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> This needs the same fix for the subject prefix that I mentioned for your
> other patch, otherwise:
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>
>
> Perhaps a good idea would be to send all of these patches with the
> subject prefix fixed up as a second version and threaded in a series.
> That makes it easier for people to pick them up (assuming Dave will take
> them directly).
>

no worries, I'll fix up the subject lines when I apply..

BR,
-R

> Thierry
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Rob Clark Dec. 1, 2014, 4:14 p.m. UTC | #3
btw, I have these two queued up on msm-next, thanks

BR,
-R

On Tue, Nov 25, 2014 at 8:33 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Nov 2014 14:30:28 +0100
>
> The functions framebuffer_release() and vunmap() perform also input
> parameter validation. 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/msm/msm_fbdev.c | 3 +--
>  drivers/gpu/drm/msm/msm_gem.c   | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
> index ab5bfd2..fd5a6f3 100644
> --- a/drivers/gpu/drm/msm/msm_fbdev.c
> +++ b/drivers/gpu/drm/msm/msm_fbdev.c
> @@ -193,8 +193,7 @@ fail_unlock:
>  fail:
>
>         if (ret) {
> -               if (fbi)
> -                       framebuffer_release(fbi);
> +               framebuffer_release(fbi);
>                 if (fb) {
>                         drm_framebuffer_unregister_private(fb);
>                         drm_framebuffer_remove(fb);
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 4b1b82a..157cf21 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -543,8 +543,7 @@ void msm_gem_free_object(struct drm_gem_object *obj)
>                         drm_free_large(msm_obj->pages);
>
>         } else {
> -               if (msm_obj->vaddr)
> -                       vunmap(msm_obj->vaddr);
> +               vunmap(msm_obj->vaddr);
>                 put_pages(obj);
>         }
>
> --
> 2.1.3
>
> --
> 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/
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index ab5bfd2..fd5a6f3 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -193,8 +193,7 @@  fail_unlock:
 fail:
 
 	if (ret) {
-		if (fbi)
-			framebuffer_release(fbi);
+		framebuffer_release(fbi);
 		if (fb) {
 			drm_framebuffer_unregister_private(fb);
 			drm_framebuffer_remove(fb);
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 4b1b82a..157cf21 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -543,8 +543,7 @@  void msm_gem_free_object(struct drm_gem_object *obj)
 			drm_free_large(msm_obj->pages);
 
 	} else {
-		if (msm_obj->vaddr)
-			vunmap(msm_obj->vaddr);
+		vunmap(msm_obj->vaddr);
 		put_pages(obj);
 	}