staging: most: fix tracking of MBO offset
authorChristian Gromm <christian.gromm@microchip.com>
Tue, 22 Dec 2015 09:52:48 +0000 (10:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 01:34:58 +0000 (17:34 -0800)
This patch increments mbo_offs by the number of bytes that have
been copied and resets it in case a complete mbo has been transferred
to user buffer.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/aim-cdev/cdev.c

index 86194ce5147296ddeff7a0b01d4ab5326388ca03..0141293b4bf54933e3be0aab210dcd62e79eb4a0 100644 (file)
@@ -257,9 +257,8 @@ start_copy:
 
        copied = to_copy - not_copied;
 
-       if (count < mbo->processed_length) {
-               channel->mbo_offs = copied;
-       } else {
+       channel->mbo_offs += copied;
+       if (channel->mbo_offs >= mbo->processed_length) {
                most_put_mbo(mbo);
                channel->mbo_offs = 0;
                channel->stacked_mbo = NULL;