Subject: [PATCH 4/7] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

From: [email-masked] (Suzuki K Poulose)
Date: Fri, 1 Jul 2016 11:29:58 +0100

On 01/07/16 10:41, Peter Chen wrote:
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
>
> Cc: Will Deacon <[email-masked]>
> Cc: Suzuki K Poulose <[email-masked]>
> Signed-off-by: Peter Chen <[email-masked]>

Thanks for the fix.

> ---
>   drivers/bus/arm-cci.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> index a49b283..e7b0b8c 100644
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -1912,9 +1912,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
>   	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
>   	for (i = 0; i < nb_cci_ports; i++) {
>   		ace_match = ports[i].type == type;
> -		if (ace_match && cci_portn == ports[i].dn)
> +		if (ace_match && cci_portn == ports[i].dn) {
> +			of_node_put(cci_portn);
>   			return i;
> +		}
>   	}
> +	of_node_put(cci_portn);

nit: Could we please do some thing like this ?
		if (ace_match && cci_portn == ports[i].dn)
			break;
	}

	of_node_put(cci_portn);
	return (i < nb_cci_ports) ? i : -ENODEV ;

Either way,

Reviewed-by: Suzuki K Poulose <[email-masked]>