linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/6] ARM: mxs: add usb phy operations
Date: Mon, 25 Jul 2011 09:24:03 +0100	[thread overview]
Message-ID: <20110725082403.GA9653@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20013.6155.531965.918650@ipc1.ka-ro>

On Mon, Jul 25, 2011 at 09:15:23AM +0200, Lothar Wa?mann wrote:
> > +	if (WARN_ON(ppriv->internal_phy_clk_already_on < 0))
> > +		printk(KERN_ERR "please check phy clock ON/OFF sequence\n");
> > +}

And there should be a blank line here.

> > +static int fsl_usb_host_init(struct platform_device *pdev)
> > +{
> > +	struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
> > +	struct mxs_usb_private_date *ppriv = pdata->ppriv;
> > +
> > +	ppriv->phy_regs = ioremap(MX28_USBPHY1_BASE_ADDR, SZ_8K);
> > +	if (ppriv->phy_regs == NULL)
> > +		return -ENOMEM;
> > +
> > +	ppriv->ctrl_regs = ioremap(MX28_USBCTRL1_BASE_ADDR, SZ_8K);
> > +	if (ppriv->ctrl_regs == NULL)
> > +		return -ENOMEM;
> > +
> What about proper cleanup in the error case?

Doing something like this is probably easiest:

	ppriv->phy_regs = ioremap(MX28_USBPHY1_BASE_ADDR, SZ_8K);
	ppriv->ctrl_regs = ioremap(MX28_USBCTRL1_BASE_ADDR, SZ_8K);
	if (!ppriv->phy_regs || !ppriv_ctrl_regs) {
		iounmap(ppriv->phy_regs);
		iounmap(ppriv->ctrl_regs);
		return -ENOMEM;
	}

As iounmap ignores NULL pointers.

  parent reply	other threads:[~2011-07-25  8:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25  7:01 [PATCH v2 0/6] ARM: mx28: add usb host function Tony Lin
2011-07-25  7:01 ` [PATCH v2 1/6] ARM: mxs: ehci: consolidate definitions and structures to share among platforms Tony Lin
2011-07-25  7:01 ` [PATCH v2 2/6] ARM: mxs: enable usb1 phy power supply Tony Lin
2011-07-25  7:01 ` [PATCH v2 3/6] ARM: mxs: add usb clocks to clock tree Tony Lin
2011-07-25 10:24   ` Sergei Shtylyov
2011-07-25 10:43     ` Lin Tony-B19295
2011-07-25  7:01 ` [PATCH v2 4/6] ARM: mxs: make ehci-mxc more flexible to be used on different platforms Tony Lin
2011-07-25  7:21   ` Lothar Waßmann
2011-07-25  7:01 ` [PATCH v2 5/6] ARM: mxs: add usb phy operations Tony Lin
2011-07-25  7:15   ` Lothar Waßmann
2011-07-25  7:26     ` Lin Tony-B19295
2011-07-25  8:24     ` Russell King - ARM Linux [this message]
2011-07-26  2:05       ` Lin Tony-B19295
2011-07-26  7:07   ` Koen Beel
2011-07-26  7:12     ` Lin Tony-B19295
2011-07-25  7:01 ` [PATCH v2 6/6] ARM: mxs: add usb host function to default config Tony Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110725082403.GA9653@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).