public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	kyungmin.park@samsung.com, s.nawrocki@samsung.com,
	mchehab@osg.samsung.com, kgene@kernel.org,
	linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] media: platform: exynos4-is: media-dev: Add missing of_node_put
Date: Tue, 26 Jan 2016 09:24:35 +0900	[thread overview]
Message-ID: <56A6BCC3.8040407@samsung.com> (raw)
In-Reply-To: <20160125152136.GA19484@amitoj-Inspiron-3542>

On 26.01.2016 00:21, Amitoj Kaur Chawla wrote:
> for_each_available_child_of_node and for_each_child_of_node perform an
> of_node_get on each iteration, so to break out of the loop an of_node_put is
> required.
> 
> Found using Coccinelle. The simplified version of the semantic patch
> that is used for this is as follows:
> 
> // <smpl>
> @@
> local idexpression n;
> expression e,r;
> @@
> 
>  for_each_available_child_of_node(r,n) {
>    ...
> (
>    of_node_put(n);
> |
>    e = n
> |
> +  of_node_put(n);
> ?  break;
> )
>    ...
>  }
> ... when != n
> // </smpl>

Patch iselft looks correct but why are you pasting coccinelle script
into the message?

The script is already present in Linux kernel:
scripts/coccinelle/iterators/device_node_continue.cocci

This just extends the commit message without any meaningful data so with
removal of coccinelle script above:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
>  drivers/media/platform/exynos4-is/media-dev.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index 4f5586a..09f6e54 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -430,8 +430,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
>  			continue;
>  
>  		ret = fimc_md_parse_port_node(fmd, port, index);
> -		if (ret < 0)
> +		if (ret < 0) {
> +			of_node_put(node);
>  			goto rpm_put;
> +		}
>  		index++;
>  	}
>  
> @@ -442,8 +444,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
>  
>  	for_each_child_of_node(ports, node) {
>  		ret = fimc_md_parse_port_node(fmd, node, index);
> -		if (ret < 0)
> +		if (ret < 0) {
> +			of_node_put(node);
>  			break;
> +		}
>  		index++;
>  	}
>  rpm_put:
> @@ -651,8 +655,10 @@ static int fimc_md_register_platform_entities(struct fimc_md *fmd,
>  			ret = fimc_md_register_platform_entity(fmd, pdev,
>  							plat_entity);
>  		put_device(&pdev->dev);
> -		if (ret < 0)
> +		if (ret < 0) {
> +			of_node_put(node);
>  			break;
> +		}
>  	}
>  
>  	return ret;
> 

  reply	other threads:[~2016-01-26  0:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 15:21 [PATCH] media: platform: exynos4-is: media-dev: Add missing of_node_put Amitoj Kaur Chawla
2016-01-26  0:24 ` Krzysztof Kozlowski [this message]
2016-01-26  6:24   ` Julia Lawall
2016-01-26  6:55     ` Krzysztof Kozlowski
2016-01-26  7:12       ` Julia Lawall
2016-01-26  9:12         ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A6BCC3.8040407@samsung.com \
    --to=k.kozlowski@samsung.com \
    --cc=amitoj1606@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=s.nawrocki@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox