Combine two conditions and make the success path explicit. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- The code is more complicated than it needs to be because of the debug code. If we just tested for error and then returned instead of trying to print a debug message that is the easiest way. Debug code is not often used. I don't like debug code very much. diff --git a/drivers/staging/dwc2/hcd_queue.c b/drivers/staging/dwc2/hcd_queue.c index ad9136e9d820..5d188254728c 100644 --- a/drivers/staging/dwc2/hcd_queue.c +++ b/drivers/staging/dwc2/hcd_queue.c @@ -517,13 +517,11 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) frame = status - 1; /* Set the new frame up */ - if (frame > -1) { + if (status >= 0) { qh->sched_frame &= ~0x7; qh->sched_frame |= (frame & 7); - } - - if (status != -1) status = 0; + } } else { status = dwc2_periodic_channel_available(hsotg); if (status) { @@ -566,7 +564,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) /* Update claimed usecs per (micro)frame */ hsotg->periodic_usecs += qh->usecs; - return status; + return 0; } /** _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel