[PATCH] pasemi: clean up gpio_mdio init

Stephen Rothwell sfr at canb.auug.org.au
Mon Nov 5 11:23:07 EST 2007


Hi Olof,

Just a couple of small things ...

On Sun, 4 Nov 2007 15:37:09 -0600 Olof Johansson <olof at lixom.net> wrote:
>
> +		ip = of_get_property(phy_dn, "interrupts", NULL);
> +		regp = of_get_property(phy_dn, "reg", NULL);
> +		if (!ip || !regp)
> +			continue;
> +		new_bus->irq[*regp] = irq_create_mapping(NULL, *ip);

Paranoid me says to check that *regp is in range.

>  int gpio_mdio_init(void)
>  {
> +	struct device_node *np;
> +
> +	np = of_find_compatible_node(NULL, "gpio", "1682m-gpio");
> +	if (!np)
> +		return -ENODEV;
> +	gpio_regs = of_iomap(np, 0);

	of_node_put(np);		?

> +	if (!gpio_regs)
> +		return -ENODEV;
> +
>  	return of_register_platform_driver(&gpio_mdio_driver);
>  }
-- 
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/20071105/a725480a/attachment.pgp>


More information about the Linuxppc-dev mailing list