mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-20 22:21:41 +00:00
usb: musb-new: sunxi: Fix null pointer access
When the device is in peripheral mode there is no struct usb_bus_priv allocated pointer, as the uclass driver ("usb_dev_generic") doesn't call per_device_auto_alloc_size. This results in writing to the internal SDRAM at priv->desc_before_addr = true; Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
This commit is contained in:
parent
771e76515e
commit
46a3f27654
1 changed files with 6 additions and 2 deletions
|
@ -435,11 +435,14 @@ static int musb_usb_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct sunxi_glue *glue = dev_get_priv(dev);
|
struct sunxi_glue *glue = dev_get_priv(dev);
|
||||||
struct musb_host_data *host = &glue->mdata;
|
struct musb_host_data *host = &glue->mdata;
|
||||||
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
|
|
||||||
struct musb_hdrc_platform_data pdata;
|
struct musb_hdrc_platform_data pdata;
|
||||||
void *base = dev_read_addr_ptr(dev);
|
void *base = dev_read_addr_ptr(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#ifdef CONFIG_USB_MUSB_HOST
|
||||||
|
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!base)
|
if (!base)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -459,7 +462,6 @@ static int musb_usb_probe(struct udevice *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->desc_before_addr = true;
|
|
||||||
|
|
||||||
memset(&pdata, 0, sizeof(pdata));
|
memset(&pdata, 0, sizeof(pdata));
|
||||||
pdata.power = 250;
|
pdata.power = 250;
|
||||||
|
@ -467,6 +469,8 @@ static int musb_usb_probe(struct udevice *dev)
|
||||||
pdata.config = glue->cfg->config;
|
pdata.config = glue->cfg->config;
|
||||||
|
|
||||||
#ifdef CONFIG_USB_MUSB_HOST
|
#ifdef CONFIG_USB_MUSB_HOST
|
||||||
|
priv->desc_before_addr = true;
|
||||||
|
|
||||||
pdata.mode = MUSB_HOST;
|
pdata.mode = MUSB_HOST;
|
||||||
host->host = musb_init_controller(&pdata, &glue->dev, base);
|
host->host = musb_init_controller(&pdata, &glue->dev, base);
|
||||||
if (!host->host)
|
if (!host->host)
|
||||||
|
|
Loading…
Add table
Reference in a new issue