Re: [PATCH v2] HID: cp2112: support large i2c transfers in hid-cp2112

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

 



On 07/09/2015 01:07 AM, Vaibhav Hiremath wrote:
...
+        count += ret;
+        if (count > msgs->len) {
+            /*
+             * The hardware returned too much data.
+             * This is mostly harmless because cp2112_read()
+             * has a limit check so didn't overrun our
+             * buffer.  Nevertheless, we return an error
+             * because something is seriously wrong and
+             * it shouldn't go unnoticed.
+             */
+            hid_err(hdev, "long read: %d > %zd\n",
+                ret, msgs->len - count + ret);

You may want to take another look here.
'ret' will be either,

     - ret = msgs->len
         Not applicable
     - ret > msgs->len
         (count > msgs->len) will happen in one single
         iteration, and will
     - ret < msgs->len
         (count > msgs->len) will happen in multiple iterations
         where count keeps incrementing based on ret

In the 2 scenarios above, I believe you would want to show,

     actual read bytes > requested read bytes


Am I missing something here?

(count > msgs->len) should never happen, so there's really no predicting
it.  Or do you mean something else?


I meant the message which you are printing above seems wrong to me.

It does print the size of the read request. I guess I could have written it as msgs->len - (count - ret).

Or I'm still missing what you mean.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" 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 Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux