[media] s3c-camif: Remove redundant NULL check
authorSachin Kamat <sachin.kamat@linaro.org>
Tue, 30 Apr 2013 05:16:18 +0000 (02:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 13 Jun 2013 00:41:54 +0000 (21:41 -0300)
clk_unprepare checks for NULL pointer. Hence convert IS_ERR_OR_NULL
to IS_ERR only.
[s.nawrocki: added initialisation of the clock array to ERR_PTR() value]

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/s3c-camif/camif-core.c

index 0d0fab1a7b5e70e53c9c875790bdb4c77eb68393..b38574702fe9eb50ae3b523af5111df2628b3763 100644 (file)
@@ -341,10 +341,11 @@ static void camif_clk_put(struct camif_dev *camif)
        int i;
 
        for (i = 0; i < CLK_MAX_NUM; i++) {
-               if (IS_ERR_OR_NULL(camif->clock[i]))
+               if (IS_ERR(camif->clock[i]))
                        continue;
                clk_unprepare(camif->clock[i]);
                clk_put(camif->clock[i]);
+               camif->clock[i] = ERR_PTR(-EINVAL);
        }
 }
 
@@ -352,6 +353,9 @@ static int camif_clk_get(struct camif_dev *camif)
 {
        int ret, i;
 
+       for (i = 1; i < CLK_MAX_NUM; i++)
+               camif->clock[i] = ERR_PTR(-EINVAL);
+
        for (i = 0; i < CLK_MAX_NUM; i++) {
                camif->clock[i] = clk_get(camif->dev, camif_clocks[i]);
                if (IS_ERR(camif->clock[i])) {