[U-Boot] [PATCH v5 03/34] musb: sunxi: Use simple way to fill musb_hdrc pdata

Maxime Ripard maxime.ripard at bootlin.com
Mon Apr 23 07:51:08 UTC 2018


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 <jagan at amarulasolutions.com>
> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180423/711da2da/attachment.sig>


More information about the U-Boot mailing list