[PATCH 2/3] add MPC837x USB platform support

Stephen Rothwell sfr at canb.auug.org.au
Tue Jan 8 10:05:04 EST 2008


Hi,

Just a couple of comments.

On Mon,  7 Jan 2008 20:03:19 +0800 Li Yang <leoli at freescale.com> wrote:
>
> +static int mpc837xmds_usb_cfg(void)
> +{
>
> +	np = of_find_node_by_name(NULL, "usb");
> +	phy_type = of_get_property(np, "phy_type", NULL);

No check for np being NULL

> +	if (phy_type && !strcmp(phy_type, "ulpi")) {
> +		clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
> +	} else if (phy_type && !strcmp(phy_type, "serial")) {
> +		mode = of_get_property(np, "dr_mode", NULL);
> +		bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
> +		bcsr12 |= BCSR12_USB_SER_PIN;
> +		if (mode && !strcmp(mode, "peripheral"))
> +			bcsr12 |= BCSR12_USB_SER_DEVICE;
> +		out_8(bcsr_regs + 12, bcsr12);
> +	} else {
> +		printk(KERN_ERR "USB DR: unsupported PHY\n");
> +	}
> +
> +	iounmap(bcsr_regs);
> +	return 0;

No of_node_put(np)

> +#ifdef CONFIG_PPC_MPC837x
> +int mpc837x_usb_cfg(void)
> +{
>
> +	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
> +	if (!np)
> +		return -ENODEV;
> +	prop = of_get_property(np, "phy_type", NULL);
> +
> +	if (strcmp(prop, "ulpi") && strcmp(prop, "serial")) {

No check for prop being NULL.

> +		printk(KERN_WARNING "837x USB PHY type not supported\n");
> +		return -EINVAL;

No of_node_put(np)

-- 
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/20080108/b9b97cb8/attachment.pgp>


More information about the Linuxppc-dev mailing list