Re: [PATCH] usb: dwc3: core: cope with NULL pdata

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

 



On Wed, Aug 14, 2013 at 09:03:19AM -0500, Felipe Balbi wrote:
> On Tue, Aug 13, 2013 at 09:50:20PM +0000, Paul Zimmerman wrote:
> > > From: Felipe Balbi [mailto:balbi@xxxxxx]
> > > Sent: Tuesday, August 13, 2013 2:12 PM
> > > 
> > > if pdata is a NULL pointer we could cause a
> > > kernel oops when probing the driver. Make sure
> > > to cope with systems which won't pass pdata
> > > to the driver.
> > > 
> > > Reported-by: Paul Zimmerman <paulz@xxxxxxxxxxxx>
> > > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> > > ---
> > >  drivers/usb/dwc3/core.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > > index 3ff6f0a..577af1b 100644
> > > --- a/drivers/usb/dwc3/core.c
> > > +++ b/drivers/usb/dwc3/core.c
> > > @@ -393,7 +393,7 @@ static int dwc3_probe(struct platform_device *pdev)
> > > 
> > >  		dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
> > >  		dwc->dr_mode = of_usb_get_dr_mode(node);
> > > -	} else {
> > > +	} else if (pdata) {
> > >  		dwc->maximum_speed = pdata->maximum_speed;
> > > 
> > >  		dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
> > > @@ -401,6 +401,9 @@ static int dwc3_probe(struct platform_device *pdev)
> > > 
> > >  		dwc->needs_fifo_resize = pdata->tx_fifo_resize;
> > >  		dwc->dr_mode = pdata->dr_mode;
> > > +	} else {
> > > +		dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
> > > +		dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
> > >  	}
> > > 
> > >  	/* default to superspeed if no maximum_speed passed */
> > 
> > For PCI glue layer,
> > Tested-by: Paul Zimmerman <paulz@xxxxxxxxxxxx>
> 
> Greg, can you merge this on top of your usb-next branch ? If you wish,
> I can send another pull request. Whatever works.

Can you just resend it through email if that's easier, I don't have the
original anymore...

thanks,

greg k-h
--
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