All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check
@ 2013-01-18 20:42 Cong Ding
  2013-01-18 20:55 ` Ohad Ben-Cohen
  2013-01-28 14:22 ` Joerg Roedel
  0 siblings, 2 replies; 4+ messages in thread
From: Cong Ding @ 2013-01-18 20:42 UTC (permalink / raw)
  To: Joerg Roedel, Ohad Ben-Cohen, Tony Lindgren, Omar Ramirez Luna,
	Mauro Carvalho Chehab, linux-kernel
  Cc: Cong Ding

The pointer obj is dereferenced in line 146 and 149 respectively, so it is not
necessary to check null again in line 149 and 175. And I have checked that all
the callers of these two functions guarantee the parameter obj passed is not
null.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
 drivers/iommu/omap-iommu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d33c980..6ac02fa 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -146,7 +146,7 @@ static int iommu_enable(struct omap_iommu *obj)
 	struct platform_device *pdev = to_platform_device(obj->dev);
 	struct iommu_platform_data *pdata = pdev->dev.platform_data;
 
-	if (!obj || !pdata)
+	if (!pdata)
 		return -EINVAL;
 
 	if (!arch_iommu)
@@ -172,7 +172,7 @@ static void iommu_disable(struct omap_iommu *obj)
 	struct platform_device *pdev = to_platform_device(obj->dev);
 	struct iommu_platform_data *pdata = pdev->dev.platform_data;
 
-	if (!obj || !pdata)
+	if (!pdata)
 		return;
 
 	arch_iommu->disable(obj);
-- 
1.7.10.4


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

* Re: [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check
  2013-01-18 20:42 [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check Cong Ding
@ 2013-01-18 20:55 ` Ohad Ben-Cohen
  2013-01-22 20:17   ` Tony Lindgren
  2013-01-28 14:22 ` Joerg Roedel
  1 sibling, 1 reply; 4+ messages in thread
From: Ohad Ben-Cohen @ 2013-01-18 20:55 UTC (permalink / raw)
  To: Cong Ding
  Cc: Joerg Roedel, Tony Lindgren, Omar Ramirez Luna,
	Mauro Carvalho Chehab, linux-kernel

On Fri, Jan 18, 2013 at 10:42 PM, Cong Ding <dinggnu@gmail.com> wrote:
> The pointer obj is dereferenced in line 146 and 149 respectively, so it is not
> necessary to check null again in line 149 and 175. And I have checked that all
> the callers of these two functions guarantee the parameter obj passed is not
> null.
>
> Signed-off-by: Cong Ding <dinggnu@gmail.com>

Acked-by: Ohad Ben-Cohen <ohad@wizery.com>

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

* Re: [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check
  2013-01-18 20:55 ` Ohad Ben-Cohen
@ 2013-01-22 20:17   ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2013-01-22 20:17 UTC (permalink / raw)
  To: Ohad Ben-Cohen
  Cc: Cong Ding, Joerg Roedel, Omar Ramirez Luna,
	Mauro Carvalho Chehab, linux-kernel

* Ohad Ben-Cohen <ohad@wizery.com> [130118 12:58]:
> On Fri, Jan 18, 2013 at 10:42 PM, Cong Ding <dinggnu@gmail.com> wrote:
> > The pointer obj is dereferenced in line 146 and 149 respectively, so it is not
> > necessary to check null again in line 149 and 175. And I have checked that all
> > the callers of these two functions guarantee the parameter obj passed is not
> > null.
> >
> > Signed-off-by: Cong Ding <dinggnu@gmail.com>
> 
> Acked-by: Ohad Ben-Cohen <ohad@wizery.com>

Yes looks like that's a pointless check and would already obj being NULL would
fail earlier in those functions:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check
  2013-01-18 20:42 [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check Cong Ding
  2013-01-18 20:55 ` Ohad Ben-Cohen
@ 2013-01-28 14:22 ` Joerg Roedel
  1 sibling, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2013-01-28 14:22 UTC (permalink / raw)
  To: Cong Ding
  Cc: Ohad Ben-Cohen, Tony Lindgren, Omar Ramirez Luna,
	Mauro Carvalho Chehab, linux-kernel

On Fri, Jan 18, 2013 at 09:42:18PM +0100, Cong Ding wrote:
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
>  drivers/iommu/omap-iommu.c |    4 ++--

Applied to arm/omap, thanks.



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

end of thread, other threads:[~2013-01-28 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 20:42 [PATCH] iommu: omap-iommu.c: remove unnecessary null pointer check Cong Ding
2013-01-18 20:55 ` Ohad Ben-Cohen
2013-01-22 20:17   ` Tony Lindgren
2013-01-28 14:22 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.