re: staging: ozwpan: Added USB HCD implementation

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

 



Hello Rupesh,

The patch ae926051d7eb: "staging: ozwpan: Added USB HCD 
implementation" from Feb 20, 2012, leads to the following warning:
drivers/staging/ozwpan/ozhcd.c:1094 oz_hcd_heartbeat()
	 warn: what is this condition about? 'ep->buffered_units * 50'

drivers/staging/ozwpan/ozhcd.c
  1088          /* Check the IN isoc endpoints to see if any URBs can be completed.
  1089           */
  1090          spin_lock_bh(&ozhcd->hcd_lock);
  1091          list_for_each(e, &port->isoc_in_ep) {
  1092                  struct oz_endpoint *ep = ep_from_link(e);
  1093                  if (ep->flags & OZ_F_EP_BUFFERING) {
  1094                          if (ep->buffered_units * OZ_IN_BUFFERING_UNITS) {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's not clear what we are testing for here.  It would be false if
->buffered_units was zero or if the multiplication overflowed.  If it's
testing for integer overflows, there are better ways to write that.

It looks buggy to me, but I don't know what the intention was.

  1095                                  ep->flags &= ~OZ_F_EP_BUFFERING;
  1096                                  ep->credit = 0;
  1097                                  oz_event_log(OZ_EVT_EP_CREDIT,
  1098                                          ep->ep_num | USB_DIR_IN,
  1099                                          0, 0, ep->credit);
  1100                                  ep->last_jiffies = now;
  1101                                  ep->start_frame = 0;
  1102                                  oz_event_log(OZ_EVT_EP_BUFFERING,
  1103                                          ep->ep_num | USB_DIR_IN, 0, 0, 0);
  1104                          }
  1105                          continue;
  1106                  }
  1107                  ep->credit += jiffies_to_msecs(now - ep->last_jiffies);

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux