Re: [PATCH v2 1/3] usb: dwc2: gadget: fix below build warning

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

 



On Tuesday, August 19, 2014 9:56 AM, Peter Chen wrote:
> 
> linux-2.6/drivers/usb/dwc2/gadget.c: In function 's3c_hsotg_irq_enumdone':
> linux-2.6/drivers/usb/dwc2/gadget.c:1904: warning: 'ep_mps' may be used uninitialized in this function
> 
> Acked-by: Paul Zimmerman <Paul.Zimmerman@xxxxxxxxxxxx>
> Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
> ---
> Changes for v2:
> - Add Paul's suggestion and ack
> 
>  drivers/usb/dwc2/gadget.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 2421eaa..6bcc644 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -1901,7 +1901,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
>  static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
>  {
>  	u32 dsts = readl(hsotg->regs + DSTS);
> -	int ep0_mps = 0, ep_mps;
> +	int ep0_mps = 0, ep_mps = 1023;

(+cc  Dinh Nguyen)

static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
{
	u32 dsts = readl(hsotg->regs + DSTS);
	int ep0_mps = 0, ep_mps;

	.....

	case DSTS_ENUMSPD_FS:
	case DSTS_ENUMSPD_FS48:
		ep0_mps = EP0_MPS_LIMIT;
		ep_mps = 1023;
		break;

	case DSTS_ENUMSPD_HS:
		ep0_mps = EP0_MPS_LIMIT;
		ep_mps = 1024;
		break;

	case DSTS_ENUMSPD_LS:
		hsotg->gadget.speed = USB_SPEED_LOW;
		break;

Only low-speed does NOT set 'ep_mps'. Thus, the default value
of 'ep_mps' should be considered for the case of low-speed.
According to the USB2.0 spec, the maximum data payload size
allowed for low-speed devices is 8 bytes. So, this patch should set
the 'ep_mps' as '8' for the low-speed.

What I mean is as follows:

-	int ep0_mps = 0, ep_mps;
+	int ep0_mps = 0, ep_mps = 8;

Best regards,
Jingoo Han

> 
>  	/*
>  	 * This should signal the finish of the enumeration phase
> --
> 1.7.9.5


--
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