2015-11-23 09:28:36

by Saurabh Sengar

[permalink] [raw]
Subject: [PATCH] leds/powernv : removing NULL check

no need to explicitly check for pointer to be null,
of_prop_next_string anyways return NULL, if passed pointer is NULL
and hence loop will continue

Signed-off-by: Saurabh Sengar <[email protected]>
---
drivers/leds/leds-powernv.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c
index 1e75e1f..bc2d76e 100644
--- a/drivers/leds/leds-powernv.c
+++ b/drivers/leds/leds-powernv.c
@@ -256,8 +256,6 @@ static int powernv_led_classdev(struct platform_device *pdev,

for_each_child_of_node(led_node, np) {
p = of_find_property(np, "led-types", NULL);
- if (!p)
- continue;

while ((cur = of_prop_next_string(p, cur)) != NULL) {
powernv_led = devm_kzalloc(dev, sizeof(*powernv_led),
--
1.9.1


2015-11-23 12:37:47

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH] leds/powernv : removing NULL check

On 11/23/2015 10:28 AM, Saurabh Sengar wrote:
> no need to explicitly check for pointer to be null,
> of_prop_next_string anyways return NULL, if passed pointer is NULL
> and hence loop will continue
>
> Signed-off-by: Saurabh Sengar <[email protected]>
> ---
> drivers/leds/leds-powernv.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c
> index 1e75e1f..bc2d76e 100644
> --- a/drivers/leds/leds-powernv.c
> +++ b/drivers/leds/leds-powernv.c
> @@ -256,8 +256,6 @@ static int powernv_led_classdev(struct platform_device *pdev,
>
> for_each_child_of_node(led_node, np) {
> p = of_find_property(np, "led-types", NULL);
> - if (!p)
> - continue;
>
> while ((cur = of_prop_next_string(p, cur)) != NULL) {
> powernv_led = devm_kzalloc(dev, sizeof(*powernv_led),
>

Applied, thanks.

--
Best Regards,
Jacek Anaszewski

2015-11-25 14:44:39

by Vasant Hegde

[permalink] [raw]
Subject: Re: [PATCH] leds/powernv : removing NULL check

On 11/23/2015 02:58 PM, Saurabh Sengar wrote:
> no need to explicitly check for pointer to be null,
> of_prop_next_string anyways return NULL, if passed pointer is NULL
> and hence loop will continue

Thanks! Patch looks good.

-Vasant

2015-11-25 15:17:44

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH] leds/powernv : removing NULL check

On 11/25/2015 03:44 PM, Vasant Hegde wrote:
> On 11/23/2015 02:58 PM, Saurabh Sengar wrote:
>> no need to explicitly check for pointer to be null,
>> of_prop_next_string anyways return NULL, if passed pointer is NULL
>> and hence loop will continue
>
> Thanks! Patch looks good.
>
> -Vasant
>
>

I infer that you offer your:

Acked-by: Vasant Hegde <[email protected]>

Can I add it? :)

--
Best Regards,
Jacek Anaszewski

2015-11-25 16:42:55

by Vasant Hegde

[permalink] [raw]
Subject: Re: [PATCH] leds/powernv : removing NULL check

On 11/25/2015 08:47 PM, Jacek Anaszewski wrote:
> On 11/25/2015 03:44 PM, Vasant Hegde wrote:
>> On 11/23/2015 02:58 PM, Saurabh Sengar wrote:
>>> no need to explicitly check for pointer to be null,
>>> of_prop_next_string anyways return NULL, if passed pointer is NULL
>>> and hence loop will continue
>>
>> Thanks! Patch looks good.
>>
>> -Vasant
>>
>>
>
> I infer that you offer your:

Yes.. Forgot to add Ack-by tag.

>
> Acked-by: Vasant Hegde <[email protected]>
>
> Can I add it? :)

Sure. Thanks!

-Vasant