[PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE

Stephen Rothwell sfr at canb.auug.org.au
Thu Dec 20 10:27:40 EST 2007


On Wed, 19 Dec 2007 23:38:05 +0300 Anton Vorontsov <avorontsov at ru.mvista.com> wrote:
>
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
>  
>  	/* SPI controller is either clocked from QE or SoC clock */
>  	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -	if (!np)
> +	if (np) {
> +		sysclk = of_get_property(np, "brg-frequency", NULL);
> +		if (!sysclk)
> +			return -ENODEV;

You need an of_node_put(np) in the failing case.

> +	} else {
>  		np = of_find_node_by_type(NULL, "soc");
> +		if (!np)
> +			return -ENODEV;
>  
> -	if (!np)
> -		return -ENODEV;
> -
> -	sysclk = of_get_property(np, "bus-frequency", NULL);
> -	if (!sysclk)
> -		return -ENODEV;
> +		sysclk = of_get_property(np, "bus-frequency", NULL);
> +		if (!sysclk)
> +			return -ENODEV;

And again.

> +	}
>  
>  	for (np = NULL, i = 1;

There should be an of_node_put(np) before this as well.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20071220/ec04f1fb/attachment.pgp>


More information about the Linuxppc-dev mailing list