On Sat, Apr 21, 2018 at 05:49:14PM +0530, Jagan Teki wrote:
> Filling musb_hdrc pdata using structure will unnecessary
> add extra ifdefs, so fill them inside probe call for
> better code understanding and get rid ifdefs using
> devicetree compatible.
> 
> Signed-off-by: Jagan Teki <[email protected]>
> ---
>  drivers/usb/musb-new/sunxi.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index 3f3b89886a..0b7ff9ff09 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -308,22 +308,12 @@ static struct musb_hdrc_config musb_config = {
>       .ram_bits       = SUNXI_MUSB_RAM_BITS,
>  };
>  
> -static struct musb_hdrc_platform_data musb_plat = {
> -#if defined(CONFIG_USB_MUSB_HOST)
> -     .mode           = MUSB_HOST,
> -#else
> -     .mode           = MUSB_PERIPHERAL,
> -#endif
> -     .config         = &musb_config,
> -     .power          = 250,
> -     .platform_ops   = &sunxi_musb_ops,
> -};
> -
>  static int musb_usb_probe(struct udevice *dev)
>  {
>       struct sunxi_glue *glue = dev_get_priv(dev);
>       struct musb_host_data *host = &glue->mdata;
>       struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
> +     struct musb_hdrc_platform_data pdata;

This will allocate a value on the stack that will have a random
content, and you're not initializing it anywhere.

You need a memset here.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: PGP signature

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to