linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: android: ion: Deletion of a few unnecessary checks
       [not found]                               ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-23 18:33                                 ` SF Markus Elfring
  2014-11-23 18:39                                   ` [PATCH 1/2] staging: android: ion: Deletion of unnecessary checks before two function calls SF Markus Elfring
  2015-02-05  9:20                                 ` [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap" SF Markus Elfring
  1 sibling, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2014-11-23 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Stephen Warren, Thierry Reding, devel,
	linux-tegra
  Cc: Julia Lawall, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 19:13:56 +0100

Another update suggestion was taken into account after a patch was applied
from static source code analysis.

Markus Elfring (2):
  Deletion of unnecessary checks before two function calls
  One function call less in ion_buffer_create() after error detection

 drivers/staging/android/ion/ion.c              | 9 +++------
 drivers/staging/android/ion/ion_dummy_driver.c | 6 ++----
 drivers/staging/android/ion/tegra/tegra_ion.c  | 6 ++----
 3 files changed, 7 insertions(+), 14 deletions(-)

-- 
2.1.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] staging: android: ion: Deletion of unnecessary checks before two function calls
  2014-11-23 18:33                                 ` [PATCH 0/2] staging: android: ion: Deletion of a few unnecessary checks SF Markus Elfring
@ 2014-11-23 18:39                                   ` SF Markus Elfring
       [not found]                                     ` <547229DB.8030606-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2014-11-23 18:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Stephen Warren, Thierry Reding, devel,
	linux-tegra
  Cc: Julia Lawall, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 18:48:15 +0100

The functions ion_heap_destroy() and vfree() 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/staging/android/ion/ion.c              | 6 ++----
 drivers/staging/android/ion/ion_dummy_driver.c | 6 ++----
 drivers/staging/android/ion/tegra/tegra_ion.c  | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 2703609..df12cc3 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -263,8 +263,7 @@ err:
 	heap->ops->unmap_dma(heap, buffer);
 	heap->ops->free(buffer);
 err1:
-	if (buffer->pages)
-		vfree(buffer->pages);
+	vfree(buffer->pages);
 err2:
 	kfree(buffer);
 	return ERR_PTR(ret);
@@ -276,8 +275,7 @@ void ion_buffer_destroy(struct ion_buffer *buffer)
 		buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
 	buffer->heap->ops->unmap_dma(buffer->heap, buffer);
 	buffer->heap->ops->free(buffer);
-	if (buffer->pages)
-		vfree(buffer->pages);
+	vfree(buffer->pages);
 	kfree(buffer);
 }
 
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..d06bf52 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -112,10 +112,8 @@ static int __init ion_dummy_init(void)
 	}
 	return 0;
 err:
-	for (i = 0; i < dummy_ion_pdata.nr; i++) {
-		if (heaps[i])
-			ion_heap_destroy(heaps[i]);
-	}
+	for (i = 0; i < dummy_ion_pdata.nr; ++i)
+		ion_heap_destroy(heaps[i]);
 	kfree(heaps);
 
 	if (carveout_ptr) {
diff --git a/drivers/staging/android/ion/tegra/tegra_ion.c b/drivers/staging/android/ion/tegra/tegra_ion.c
index 11c7cce..5b8ef0e 100644
--- a/drivers/staging/android/ion/tegra/tegra_ion.c
+++ b/drivers/staging/android/ion/tegra/tegra_ion.c
@@ -54,10 +54,8 @@ static int tegra_ion_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, idev);
 	return 0;
 err:
-	for (i = 0; i < num_heaps; i++) {
-		if (heaps[i])
-			ion_heap_destroy(heaps[i]);
-	}
+	for (i = 0; i < num_heaps; ++i)
+		ion_heap_destroy(heaps[i]);
 	return err;
 }
 
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] staging: android: ion: Deletion of unnecessary checks before two function calls
       [not found]                                     ` <547229DB.8030606-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
@ 2014-12-02  9:59                                       ` Thierry Reding
  0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2014-12-02  9:59 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Greg Kroah-Hartman, Stephen Warren,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, LKML,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Julia Lawall

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

On Sun, Nov 23, 2014 at 07:39:23PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Date: Sun, 23 Nov 2014 18:48:15 +0100
> 
> The functions ion_heap_destroy() and vfree() 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-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> ---
>  drivers/staging/android/ion/ion.c              | 6 ++----
>  drivers/staging/android/ion/ion_dummy_driver.c | 6 ++----
>  drivers/staging/android/ion/tegra/tegra_ion.c  | 6 ++----
>  3 files changed, 6 insertions(+), 12 deletions(-)

Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree"
  2015-02-05 17:00                                   ` [PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree" SF Markus Elfring
@ 2015-01-09  6:58                                     ` SF Markus Elfring
  0 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2015-01-09  6:58 UTC (permalink / raw)
  To: Alexandre Courbot, Hiroshi Doyu, Jörg Rödel,
	Stephen Warren, Thierry Reding, iommu, linux-tegra
  Cc: LKML, kernel-janitors, Julia Lawall

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Feb 2015 17:54:16 +0100
> 
> The vfree() function performs 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/iommu/tegra-gart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
> index f722a0c..07a795a 100644
> --- a/drivers/iommu/tegra-gart.c
> +++ b/drivers/iommu/tegra-gart.c
> @@ -404,8 +404,7 @@ static int tegra_gart_remove(struct platform_device *pdev)
>  	struct gart_device *gart = platform_get_drvdata(pdev);
>  
>  	writel(0, gart->regs + GART_CONFIG);
> -	if (gart->savedata)
> -		vfree(gart->savedata);
> +	vfree(gart->savedata);
>  	gart_handle = NULL;
>  	return 0;
>  }
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap"
       [not found]                               ` <5317A59D.4@users.sourceforge.net>
  2014-11-23 18:33                                 ` [PATCH 0/2] staging: android: ion: Deletion of a few unnecessary checks SF Markus Elfring
@ 2015-02-05  9:20                                 ` SF Markus Elfring
  2015-07-08 18:40                                   ` SF Markus Elfring
  1 sibling, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2015-02-05  9:20 UTC (permalink / raw)
  To: Alexandre Courbot, David Airlie, Stephen Warren,
	Terje Bergström, Thierry Reding, dri-devel, linux-tegra
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Feb 2015 10:12:51 +0100

The vunmap() function performs 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/tegra/fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index e9c715d..803598e 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -66,7 +66,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)
 		struct tegra_bo *bo = fb->planes[i];
 
 		if (bo) {
-			if (bo->pages && bo->vaddr)
+			if (bo->pages)
 				vunmap(bo->vaddr);
 
 			drm_gem_object_unreference_unlocked(&bo->gem);
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree"
       [not found]                                 ` <5317A59D.4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
@ 2015-02-05 17:00                                   ` SF Markus Elfring
  2015-01-09  6:58                                     ` SF Markus Elfring
  0 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2015-02-05 17:00 UTC (permalink / raw)
  To: Alexandre Courbot, Hiroshi Doyu, Jörg Rödel,
	Stephen Warren, Thierry Reding,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Julia Lawall

From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Date: Thu, 5 Feb 2015 17:54:16 +0100

The vfree() function performs 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-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 drivers/iommu/tegra-gart.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
index f722a0c..07a795a 100644
--- a/drivers/iommu/tegra-gart.c
+++ b/drivers/iommu/tegra-gart.c
@@ -404,8 +404,7 @@ static int tegra_gart_remove(struct platform_device *pdev)
 	struct gart_device *gart = platform_get_drvdata(pdev);
 
 	writel(0, gart->regs + GART_CONFIG);
-	if (gart->savedata)
-		vfree(gart->savedata);
+	vfree(gart->savedata);
 	gart_handle = NULL;
 	return 0;
 }
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap"
  2015-02-05  9:20                                 ` [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap" SF Markus Elfring
@ 2015-07-08 18:40                                   ` SF Markus Elfring
  2015-07-13 14:16                                     ` Alexandre Courbot
  0 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2015-07-08 18:40 UTC (permalink / raw)
  To: Alexandre Courbot, David Airlie, Stephen Warren,
	Terje Bergström, Thierry Reding, dri-devel, linux-tegra
  Cc: LKML, kernel-janitors, Julia Lawall

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Feb 2015 10:12:51 +0100
> 
> The vunmap() function performs 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/tegra/fb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
> index e9c715d..803598e 100644
> --- a/drivers/gpu/drm/tegra/fb.c
> +++ b/drivers/gpu/drm/tegra/fb.c
> @@ -66,7 +66,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)
>  		struct tegra_bo *bo = fb->planes[i];
>  
>  		if (bo) {
> -			if (bo->pages && bo->vaddr)
> +			if (bo->pages)
>  				vunmap(bo->vaddr);
>  
>  			drm_gem_object_unreference_unlocked(&bo->gem);
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap"
  2015-07-08 18:40                                   ` SF Markus Elfring
@ 2015-07-13 14:16                                     ` Alexandre Courbot
  2016-07-16  5:30                                       ` [PATCH] drm/tegra: " SF Markus Elfring
  0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Courbot @ 2015-07-13 14:16 UTC (permalink / raw)
  To: SF Markus Elfring, Thierry Reding
  Cc: Terje Bergström, Stephen Warren, kernel-janitors, LKML,
	dri-devel@lists.freedesktop.org, Julia Lawall,
	linux-tegra@vger.kernel.org

On Thu, Jul 9, 2015 at 3:40 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Thu, 5 Feb 2015 10:12:51 +0100
>>
>> The vunmap() function performs also input parameter validation.
>> Thus the test around the call is not needed.
>>
>> This issue was detected by using the Coccinelle software.

The fix is correct, but the subject looks weird.
"GPU-DRM-Tegra:"should be "drm/tegra:".

Otherwise,

Acked-by: Alexandre Courbot <acourbot@nvidia.com>

Maybe Thierry can take it through his tree once this issue is addressed?
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] drm/tegra: Delete an unnecessary check before the function call "vunmap"
  2015-07-13 14:16                                     ` Alexandre Courbot
@ 2016-07-16  5:30                                       ` SF Markus Elfring
  0 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2016-07-16  5:30 UTC (permalink / raw)
  To: linux-tegra, dri-devel, Terje Bergström, Thierry Reding,
	Stephen Warren, David Airlie, Alexandre Courbot
  Cc: Julia Lawall, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Jul 2016 07:23:42 +0200

The vunmap() function performs 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/tegra/fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 1b12aa7..e6d71fa 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -68,7 +68,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)
 		struct tegra_bo *bo = fb->planes[i];
 
 		if (bo) {
-			if (bo->pages && bo->vaddr)
+			if (bo->pages)
 				vunmap(bo->vaddr);
 
 			drm_gem_object_unreference_unlocked(&bo->gem);
-- 
2.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-16  5:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.sourceforge.net>
2014-11-23 18:33                                 ` [PATCH 0/2] staging: android: ion: Deletion of a few unnecessary checks SF Markus Elfring
2014-11-23 18:39                                   ` [PATCH 1/2] staging: android: ion: Deletion of unnecessary checks before two function calls SF Markus Elfring
     [not found]                                     ` <547229DB.8030606-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2014-12-02  9:59                                       ` Thierry Reding
2015-02-05  9:20                                 ` [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap" SF Markus Elfring
2015-07-08 18:40                                   ` SF Markus Elfring
2015-07-13 14:16                                     ` Alexandre Courbot
2016-07-16  5:30                                       ` [PATCH] drm/tegra: " SF Markus Elfring
     [not found]                               ` <5317A59D.4@users.so urceforge.net>
     [not found]                                 ` <5317A59D.4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2015-02-05 17:00                                   ` [PATCH] IOMMU-Tegra: gart: Delete an unnecessary check before the function call "vfree" SF Markus Elfring
2015-01-09  6:58                                     ` SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).