[PATCH 2/6] MPC5121 clock driver

Stephen Rothwell sfr at canb.auug.org.au
Sat Jun 21 14:39:13 EST 2008


Hi John,

On Fri, 20 Jun 2008 10:58:35 -0600 John Rigby <jrigby at freescale.com> wrote:
>
> +struct module;

Since you include linux/module.h, you don't need this.

> +static unsigned long devtree_getfreq(char *nodetype, char *clockname)
> +{
> +	struct device_node *node;
> +	const unsigned int *fp;
> +	unsigned int val = 0;
> +
> +	node = of_find_node_by_type(NULL, "soc");
> +	if (node) {
> +		fp = of_get_property(node, clockname, NULL);
> +		if (fp)
> +			val = of_read_ulong(fp, 1);
> +	}
> +	return val;

You leak a reference to the node here. Also every call has nodetype set to
"soc" and you don't use nodetype anyway.

-- 
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: 197 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080621/988526b4/attachment.pgp>


More information about the Linuxppc-dev mailing list