Re: [PATCH] USB: add support for SuperH OHCI

Alan Stern <[email protected]> Thu, 10 Jan 2008 10:46:46 -0500 (EST)
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Thu, 10 Jan 2008, Yoshihiro Shimoda wrote:

> add support for SuperH OHCI.

> +static int usb_ohci_sh_probe(const struct hc_driver *driver,
> +				struct platform_device *pdev)
> +{
> +	struct resource *res = NULL;
> +	int irq = -1;
> +	struct usb_hcd *hcd = NULL;
> +	int ret = 0;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		ret = -ENODEV;
> +		err("platform_get_resource_byname error.");
> +		goto clean_up;
> +	}
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0) {
> +		ret = -ENODEV;
> +		err("platform_get_irq error.");
> +		goto clean_up;
> +	}
> +
> +	/* initialize hcd */
> +	hcd = usb_create_hcd(driver, &pdev->dev, (char *)hcd_name);
> +	if (!hcd) {
> +		ret = -ENOMEM;
> +		err("Failed to create hcd");
> +		goto clean_up;
> +	}
> +
> +	hcd->regs = (void __iomem *)res->start;
> +	hcd->rsrc_start = res->start;
> +	hcd->rsrc_len = resource_len(res);
> +	ret = usb_add_hcd(hcd, irq, 0);

The last argument should be IRQF_DISABLED, not 0.

> +	if (ret != 0) {
> +		err("Failed to add hcd");
> +		goto clean_up;

This line should be "usb_put_hcd(hcd);" instead of "goto clean_up;".

> +	}
> +
> +clean_up:
> +	return ret;
> +}

"clean_up" isn't a very good label, because the code doesn't 
actually clean up anything.  It just returns.

Alan Stern


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel