[U-Boot] U-Boot DWC2 warning removal

Stephen Warren swarren at wwwdotorg.org
Tue Feb 4 07:42:20 CET 2014


Oleksandr, I made the following changes to remove some warnings from
your DWC2 driver. I'm not sure they're correct; perhaps they expose some
bugs...

> diff --git a/drivers/usb/host/dwc_otg-hcd.c b/drivers/usb/host/dwc_otg-hcd.c
> index a964681..e3c26f3 100644
> --- a/drivers/usb/host/dwc_otg-hcd.c
> +++ b/drivers/usb/host/dwc_otg-hcd.c
> @@ -249,7 +249,6 @@ static int dwc_otg_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
>  	int stat = 0;
>  	__u16 bmRType_bReq;
>  	__u16 wValue;
> -	__u16 wIndex;
>  	__u16 wLength;
>  	unsigned char data[32];
>  	hprt0_data_t hprt0 = {.d32 = 0 };
> @@ -261,7 +260,6 @@ static int dwc_otg_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
>  
>  	bmRType_bReq  = cmd->requesttype | (cmd->request << 8);
>  	wValue	      = cpu_to_le16 (cmd->value);
> -	wIndex	      = cpu_to_le16 (cmd->index);
>  	wLength	      = cpu_to_le16 (cmd->length);
>  
>  	switch (bmRType_bReq) {

Perhaps wIndex should be used?

> @@ -598,7 +596,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
>  	hctsiz_data_t hctsiz;
>  	dwc_otg_host_if_t *host_if = g_core_if.host_if;
>  	dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[CHANNEL];
> -	hcint_data_t hcint;
>  	hcint_data_t hcint_new;
>  	/* For CONTROL endpoint pid should start with DATA1 */
>  	int status_direction;
> @@ -632,9 +629,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
>  	hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar);
>  	hcchar.b.multicnt = 1; 
>  
> -	/* Remember original int status */
> -   	hcint.d32 = dwc_read_reg32(&hc_regs->hcint);

Does this read have a side-effect; should I keep the call to
dwc_read_reg32(), but just remove the assignment?

The comment implies this value is saved so that it can be restored
later. However, I don't see anywhere that restores it; does that code
need to be added?

> -
>  	/* Set host channel enable after all other setup is complete. */
>  	hcchar.b.chen = 1;
>  	hcchar.b.chdis = 0;
> @@ -677,8 +671,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
>  		hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar);
>  		hcchar.b.multicnt = 1; 
>  
> -		hcint.d32 = dwc_read_reg32(&hc_regs->hcint);
> -
>  		/* Set host channel enable after all other setup is complete. */
>  		hcchar.b.chen = 1;
>  		hcchar.b.chdis = 0;
> @@ -731,8 +723,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
>  	hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar);
>  	hcchar.b.multicnt = 1; 
>  
> -   	hcint.d32 = dwc_read_reg32(&hc_regs->hcint);
> -
>  	/* Set host channel enable after all other setup is complete. */
>  	hcchar.b.chen = 1;
>  	hcchar.b.chdis = 0;



More information about the U-Boot mailing list