diff mbox

[1/4,media] s3c-camif: Remove redundant NULL check

Message ID 5180E117.1020006@gmail.com
State New
Headers show

Commit Message

Sylwester Nawrocki May 1, 2013, 9:32 a.m. UTC
On 04/30/2013 08:16 AM, Sachin Kamat wrote:
> clk_unprepare checks for NULL pointer. Hence convert IS_ERR_OR_NULL
> to IS_ERR only.
>
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> ---
>   drivers/media/platform/s3c-camif/camif-core.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
> index 0d0fab1..2449f13 100644
> --- a/drivers/media/platform/s3c-camif/camif-core.c
> +++ b/drivers/media/platform/s3c-camif/camif-core.c
> @@ -341,7 +341,7 @@ 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]);

Patch applied for 3.11 with following chunk squashed to it:


Thanks!
Sylwester

Comments

Sachin Kamat May 2, 2013, 4:20 a.m. UTC | #1
On 1 May 2013 15:02, Sylwester Nawrocki <sylvester.nawrocki@gmail.com> wrote:
> On 04/30/2013 08:16 AM, Sachin Kamat wrote:
>>
>> clk_unprepare checks for NULL pointer. Hence convert IS_ERR_OR_NULL
>> to IS_ERR only.
>>
>> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
>> ---
>>   drivers/media/platform/s3c-camif/camif-core.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/platform/s3c-camif/camif-core.c
>> b/drivers/media/platform/s3c-camif/camif-core.c
>> index 0d0fab1..2449f13 100644
>> --- a/drivers/media/platform/s3c-camif/camif-core.c
>> +++ b/drivers/media/platform/s3c-camif/camif-core.c
>> @@ -341,7 +341,7 @@ 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]);
>
>
> Patch applied for 3.11 with following chunk squashed to it:

Thanks Sylwester.
diff mbox

Patch

diff --git a/drivers/media/platform/s3c-camif/camif-core.c 
b/drivers/media/platform/s3c-camif/camif-core.c
index 2449f13..b385747 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -345,6 +345,7 @@  static void camif_clk_put(struct camif_dev *camif)
                         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])) {