OSDN Git Service

net: ipa: count actual work done in gsi_channel_poll()
authorAlex Elder <elder@linaro.org>
Thu, 21 Jan 2021 11:48:17 +0000 (05:48 -0600)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 Jan 2021 21:15:59 +0000 (13:15 -0800)
commitc80c4a1ea47f354584c8055015561c4f1ece8f7a
tree693de1f7fcb01e291d3848493b5e3f205fa6a377
parent59a49d9617e2e59006466e4ff03edf612f1c9e15
net: ipa: count actual work done in gsi_channel_poll()

There is an off-by-one problem in gsi_channel_poll().  The count of
transactions completed is incremented each time through the loop
*before* determining whether there is any more work to do.  As a
result, if we exit the loop early the counter its value is one more
than the number of transactions actually processed.

Instead, increment the count after processing, to ensure it reflects
the number of processed transactions.  The result is more naturally
described as a for loop rather than a while loop, so change that.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/gsi.c