iommu: omap-iommu.c: remove unnecessary null pointer check
PATCH 1/1 iommu: omap-iommu.c: remove unnecessary null pointer check
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.
--- drivers/iommu/omap-iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/omap-iommu.c +2 -2
@@ -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);
Signature · 1 line
1.7.10.4
Quoted 6 lines · 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 <[email protected]>
Tony Lindgren
Acked-byQuoted 9 lines · Ohad Ben-Cohen
Quoted 6 lines · 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 <[email protected]>Acked-by Ohad Ben-Cohen <[email protected]>
Yes looks like that's a pointless check and would already obj being NULL would fail earlier in those functions:
Quoted 3 lines · Cong Ding
Signed-off-by Cong Ding <[email protected]>--- drivers/iommu/omap-iommu.c | 4 ++--
Applied to arm/omap, thanks.