Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbbKPOaY (ORCPT ); Mon, 16 Nov 2015 09:30:24 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:64678 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbbKPOaW (ORCPT ); Mon, 16 Nov 2015 09:30:22 -0500 X-AuditID: cbfec7f5-f794b6d000001495-68-5649e87b120d Message-id: <5649E87A.8030602@samsung.com> Date: Mon, 16 Nov 2015 15:30:18 +0100 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: Rob Herring Cc: Ingi Kim , 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> In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t/xK7rVLzzDDFpaFCx23PzCZnF51xw2 i61v1jFatO49wu7A4rFpVSebR9+WVYwenzfJBTBHcdmkpOZklqUW6dslcGWsWrqBpeCScMXf jmOMDYytfF2MHBwSAiYSF35JdTFyApliEhfurWfrYuTiEBJYyiix40AXO4TzjFFi5qb9rCBV vAJaEku3vgKzWQRUJW7fuswEYrMJGEr8fPEazBYViJD4c3ofVL2gxI/J91hAbBEBFYkNz28x gwxlFpjJKHHtfisbSEJYwFri4aq3LBDb1jJK/Po4nR0kwSkQLPF58iWwqcwCZhKPWtYxQ9jy EpvXvGWewCgwC8mSWUjKZiEpW8DIvIpRNLU0uaA4KT3XSK84Mbe4NC9dLzk/dxMjJGy/7mBc eszqEKMAB6MSD++JJ+5hQqyJZcWVuYcYJTiYlUR4u057hgnxpiRWVqUW5ccXleakFh9ilOZg URLnnbnrfYiQQHpiSWp2ampBahFMlomDU6qB8TZ3zx1Dxpnbn7RdD9A2PTvvHNvBPu/w6eck 3FW/pvTxWZzdHXDp94uOd2uaFlR+yxTLWnfX5o6cf4PIK1ZuXdXrMndnC6z7rPBo07zQ1CfJ Wxae/zS/axFL3+uthbttz15Jfzf/BKOSUPHB6b0f260f5vvcKHq/y+b2wtJzn/+nHz6ey7bh +3wlluKMREMt5qLiRADg2tk5VwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2686 Lines: 78 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/ > -- 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/