RE: [PATCH v2 5/6] ARM: mxs: add usb phy operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux@xxxxxxxxxxxxxxxx]
> Sent: Monday, July 25, 2011 4:24 PM
> To: Lothar Waßmann
> Cc: Lin Tony-B19295; koen.beel.barco@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx;
> stern@xxxxxxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 5/6] ARM: mxs: add usb phy operations
> 
> 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.
 good suggestion, thank you.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux