iommu/msm: Deletion of unnecessary checks before clk_disable()
authorSF Markus Elfring <elfring@users.sourceforge.net>
Wed, 22 Oct 2014 18:00:17 +0000 (20:00 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 23 Oct 2014 12:47:40 +0000 (14:47 +0200)
A semantic patch approach was proposed with the subject
"[PATCH with Coccinelle?] Deletion of unnecessary checks
before specific function calls" on 2014-03-05.
https://lkml.org/lkml/2014/3/5/344
http://article.gmane.org/gmane.comp.version-control.coccinelle/3513/

This patch pattern application was repeated with the help of
the software "Coccinelle 1.0.0-rc22" on the source files for
Linux 3.17.1. An extract of the automatically generated
update suggestions is shown here.

It was determined that the affected source code places call
functions which perform input parameter validation already.
It is therefore not needed that a similar safety check is
repeated at the call site.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/msm_iommu.c
drivers/iommu/msm_iommu_dev.c

index 6e3dcc289d59d49c2cec89a4c0abcba19c3b01bd..3e4d888bef2b4a207a891da93fef9c5ec2083a21 100644 (file)
@@ -73,8 +73,7 @@ fail:
 
 static void __disable_clocks(struct msm_iommu_drvdata *drvdata)
 {
-       if (drvdata->clk)
-               clk_disable(drvdata->clk);
+       clk_disable(drvdata->clk);
        clk_disable(drvdata->pclk);
 }
 
index 61def7cb52633c04b4ea764f4948de69d12656f4..9574d217227c8623fc82bfba710fa459613da159 100644 (file)
@@ -224,8 +224,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, drvdata);
 
-       if (iommu_clk)
-               clk_disable(iommu_clk);
+       clk_disable(iommu_clk);
 
        clk_disable(iommu_pclk);
 
@@ -323,8 +322,7 @@ static int msm_iommu_ctx_probe(struct platform_device *pdev)
                SET_NSCFG(drvdata->base, mid, 3);
        }
 
-       if (drvdata->clk)
-               clk_disable(drvdata->clk);
+       clk_disable(drvdata->clk);
        clk_disable(drvdata->pclk);
 
        dev_info(&pdev->dev, "context %s using bank %d\n", c->name, c->num);