OSDN Git Service

Staging: dwc2: Fix conditional statement since urb->actual_length is never less than...
authorRashika Kheria <rashika.kheria@gmail.com>
Sat, 26 Oct 2013 17:41:22 +0000 (23:11 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Oct 2013 21:54:49 +0000 (14:54 -0700)
This patch fixes the following smatch warning in hcd.c:
drivers/staging/dwc2/hcd.c:787 dwc2_assign_and_init_hc() warn: unsigned 'urb->actual_length' is never less than zero.

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dwc2/hcd.c

index 83629d8..3cfd2d5 100644 (file)
@@ -784,8 +784,8 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
        chan->data_pid_start = qh->data_toggle;
        chan->multi_count = 1;
 
-       if ((urb->actual_length < 0 || urb->actual_length > urb->length) &&
-           !dwc2_hcd_is_pipe_in(&urb->pipe_info))
+       if (urb->actual_length > urb->length &&
+               !dwc2_hcd_is_pipe_in(&urb->pipe_info))
                urb->actual_length = urb->length;
 
        if (hsotg->core_params->dma_enable > 0) {