Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1270207 > unrolled thread
| Started by | Rob Herring <robh+dt@kernel.org> |
|---|---|
| First post | 2015-11-16 15:20 +0100 |
| Last post | 2015-11-17 01:10 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] leds: ktd2692: Add missing of_node_put Rob Herring <robh+dt@kernel.org> - 2015-11-16 15:20 +0100
Re: [PATCH] leds: ktd2692: Add missing of_node_put Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-11-16 15:40 +0100
Re: [PATCH] leds: ktd2692: Add missing of_node_put Ingi Kim <ingi2.kim@samsung.com> - 2015-11-17 01:10 +0100
| From | Rob Herring <robh+dt@kernel.org> |
|---|---|
| Date | 2015-11-16 15:20 +0100 |
| Subject | Re: [PATCH] leds: ktd2692: Add missing of_node_put |
| Message-ID | <qvsNr-8o3-11@gated-at.bofh.it> |
On Mon, Nov 16, 2015 at 4:00 AM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> Hi Ingi, Rob,
>
> With this patch we will be leaking of_node when parsing succeeds.
> I think that "return 0" should be removed. I can remove it and apply,
> provided that Rob's ack is still in force with this. Rob?
Okay.
Rob
>
> Best Regards,
> Jacek Anaszewski
>
>
> On 11/10/2015 04:00 AM, Ingi Kim wrote:
>>
>> The refcount of device_node increases after of_node_get() is called.
>> So, a break out of the loop requires of_node_put().
>>
>> This patch adds missing of_node_put() when loop breaks.
>>
>> Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
>> ---
>> drivers/leds/leds-ktd2692.c | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
>> index feca07b..dbf37ce 100644
>> --- a/drivers/leds/leds-ktd2692.c
>> +++ b/drivers/leds/leds-ktd2692.c
>> @@ -332,21 +332,26 @@ static int ktd2692_parse_dt(struct ktd2692_context
>> *led, struct device *dev,
>> &cfg->movie_max_microamp);
>> if (ret) {
>> dev_err(dev, "failed to parse led-max-microamp\n");
>> - return ret;
>> + goto err_parse_dt;
>> }
>>
>> ret = of_property_read_u32(child_node, "flash-max-microamp",
>> &cfg->flash_max_microamp);
>> if (ret) {
>> dev_err(dev, "failed to parse flash-max-microamp\n");
>> - return ret;
>> + goto err_parse_dt;
>> }
>>
>> ret = of_property_read_u32(child_node, "flash-max-timeout-us",
>> &cfg->flash_max_timeout);
>> - if (ret)
>> + if (ret) {
>> dev_err(dev, "failed to parse flash-max-timeout-us\n");
>> + goto err_parse_dt;
>> + }
>> +
>> + return 0;
>>
>> +err_parse_dt:
>> of_node_put(child_node);
>> return ret;
>> }
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jacek Anaszewski <j.anaszewski@samsung.com> |
|---|---|
| Date | 2015-11-16 15:40 +0100 |
| Message-ID | <qvt6O-8uH-35@gated-at.bofh.it> |
| In reply to | #1270207 |
On 11/16/2015 03:09 PM, Rob Herring wrote:
> On Mon, Nov 16, 2015 at 4:00 AM, Jacek Anaszewski
> <j.anaszewski@samsung.com> wrote:
>> Hi Ingi, Rob,
>>
>> With this patch we will be leaking of_node when parsing succeeds.
>> I think that "return 0" should be removed. I can remove it and apply,
>> provided that Rob's ack is still in force with this. Rob?
>
> Okay.
Removed discussed line and applied, thanks.
>> On 11/10/2015 04:00 AM, Ingi Kim wrote:
>>>
>>> The refcount of device_node increases after of_node_get() is called.
>>> So, a break out of the loop requires of_node_put().
>>>
>>> This patch adds missing of_node_put() when loop breaks.
>>>
>>> Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
>>> ---
>>> drivers/leds/leds-ktd2692.c | 11 ++++++++---
>>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
>>> index feca07b..dbf37ce 100644
>>> --- a/drivers/leds/leds-ktd2692.c
>>> +++ b/drivers/leds/leds-ktd2692.c
>>> @@ -332,21 +332,26 @@ static int ktd2692_parse_dt(struct ktd2692_context
>>> *led, struct device *dev,
>>> &cfg->movie_max_microamp);
>>> if (ret) {
>>> dev_err(dev, "failed to parse led-max-microamp\n");
>>> - return ret;
>>> + goto err_parse_dt;
>>> }
>>>
>>> ret = of_property_read_u32(child_node, "flash-max-microamp",
>>> &cfg->flash_max_microamp);
>>> if (ret) {
>>> dev_err(dev, "failed to parse flash-max-microamp\n");
>>> - return ret;
>>> + goto err_parse_dt;
>>> }
>>>
>>> ret = of_property_read_u32(child_node, "flash-max-timeout-us",
>>> &cfg->flash_max_timeout);
>>> - if (ret)
>>> + if (ret) {
>>> dev_err(dev, "failed to parse flash-max-timeout-us\n");
>>> + goto err_parse_dt;
>>> + }
>>> +
>>> + return 0;
>>>
>>> +err_parse_dt:
>>> of_node_put(child_node);
>>> return ret;
>>> }
>>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingi Kim <ingi2.kim@samsung.com> |
|---|---|
| Date | 2015-11-17 01:10 +0100 |
| Message-ID | <qvC0r-5SY-29@gated-at.bofh.it> |
| In reply to | #1270239 |
Hi Rob, Jacek
You're right,
It is better to remove "return 0"
Thanks for the review.
On 2015년 11월 16일 23:30, Jacek Anaszewski wrote:
> On 11/16/2015 03:09 PM, Rob Herring wrote:
>> On Mon, Nov 16, 2015 at 4:00 AM, Jacek Anaszewski
>> <j.anaszewski@samsung.com> wrote:
>>> Hi Ingi, Rob,
>>>
>>> With this patch we will be leaking of_node when parsing succeeds.
>>> I think that "return 0" should be removed. I can remove it and apply,
>>> provided that Rob's ack is still in force with this. Rob?
>>
>> Okay.
>
> Removed discussed line and applied, thanks.
>
>>> On 11/10/2015 04:00 AM, Ingi Kim wrote:
>>>>
>>>> The refcount of device_node increases after of_node_get() is called.
>>>> So, a break out of the loop requires of_node_put().
>>>>
>>>> This patch adds missing of_node_put() when loop breaks.
>>>>
>>>> Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
>>>> ---
>>>> drivers/leds/leds-ktd2692.c | 11 ++++++++---
>>>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
>>>> index feca07b..dbf37ce 100644
>>>> --- a/drivers/leds/leds-ktd2692.c
>>>> +++ b/drivers/leds/leds-ktd2692.c
>>>> @@ -332,21 +332,26 @@ static int ktd2692_parse_dt(struct ktd2692_context
>>>> *led, struct device *dev,
>>>> &cfg->movie_max_microamp);
>>>> if (ret) {
>>>> dev_err(dev, "failed to parse led-max-microamp\n");
>>>> - return ret;
>>>> + goto err_parse_dt;
>>>> }
>>>>
>>>> ret = of_property_read_u32(child_node, "flash-max-microamp",
>>>> &cfg->flash_max_microamp);
>>>> if (ret) {
>>>> dev_err(dev, "failed to parse flash-max-microamp\n");
>>>> - return ret;
>>>> + goto err_parse_dt;
>>>> }
>>>>
>>>> ret = of_property_read_u32(child_node, "flash-max-timeout-us",
>>>> &cfg->flash_max_timeout);
>>>> - if (ret)
>>>> + if (ret) {
>>>> dev_err(dev, "failed to parse flash-max-timeout-us\n");
>>>> + goto err_parse_dt;
>>>> + }
>>>> +
>>>> + return 0;
>>>>
>>>> +err_parse_dt:
>>>> of_node_put(child_node);
>>>> return ret;
>>>> }
>>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web