Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752694AbbKQAGA (ORCPT ); Mon, 16 Nov 2015 19:06:00 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:57871 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236AbbKQAF6 convert rfc822-to-8bit (ORCPT ); Mon, 16 Nov 2015 19:05:58 -0500 X-AuditID: cbfee690-f794e6d0000014de-e1-564a6f64b4c3 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT Message-id: <564A6F64.1080101@samsung.com> Date: Tue, 17 Nov 2015 09:05:56 +0900 From: Ingi Kim User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Jacek Anaszewski , Rob Herring Cc: Linux LED Subsystem , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] leds: ktd2692: Add missing of_node_put References: <1447124424-16525-1-git-send-email-ingi2.kim@samsung.com> <5649A92C.1020502@samsung.com> <5649E87A.8030602@samsung.com> In-reply-to: <5649E87A.8030602@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWyRsSkRDcl3yvMoPOOjEXv1eeMFpd3zWGz 2PpmHaNF694j7A4sHptWdbJ59G1ZxejxeZNcAHMUl01Kak5mWWqRvl0CV8af5iesBctFKxpP L2NtYNzJ38XIySEhYCLxvuUxC4QtJnHh3nq2LkYuDiGBFYwS564vY4cpenvzKRuILSQwi1Fi wUVjEJtXQFDix+R7QM0cHMwC6hJTpuSChJkFRCTm3Z7HDmFrSyxb+JoZYuYDRontlx6zQ/Rq SXy8f5kRpJdFQFVi5W4+kDCbgJrEjRULmUBsUYEEieNnf4DZIgLBEmtX3WODmFkqMf91O9gY YQFriYer3rJAzD/HKHFj5VWwBk6gxdsuN4MtlhBYxS6xePY6sASLgIDEt8mHwI6WEJCV2HSA GeJHSYm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+pg4OKUaGNNjvxRlHOax6muYmW162fVJpw9L9L/wrXXTI/o39rTNsry8 65Xf3vfPvlVUmuyPyC6+lTc76z/jwjaBvwpCihsK7P3btpi3sjyQ7Y7Sn/w4/e4SDu/1Xx8n Z+zwtFypxKMt6dH0Vut/k/xhvu7l35/ESUpNYS6snlj8TqG8IfSdm26cio6zEktxRqKhFnNR cSIAFw6nPOYCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2870 Lines: 83 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 >> 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 >>>> --- >>>> 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/