summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-01-26 14:20:15 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-28 11:16:18 -0800
commitfd27ae76d29d59aa834bf26d45535b1ba09ab543 (patch)
treebdadf3089c3eabef3ee62cc31fee3cff5282db6f
parent119c964399559e4bbfda9cdd7161c499ddba1470 (diff)
staging: comedi: pcl812: fix logic error in pcl812_ai_setup_dma()
commit 92afc2b229038d7b962ae69de5b07bc6c1cf51bf inroduced a logic error in the DMA size calculation. If the 'nsamples' is greater than the 'unread_samples' then DMA needs to be restarted. The current code checks it agains the 'max_samples'. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/pcl812.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c
index 37cc5e45f10c..3ffb1ea2ecc8 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -559,8 +559,8 @@ static void pcl812_ai_setup_dma(struct comedi_device *dev,
* unread samples and the number of samples remaining in the command.
*/
nsamples = comedi_nsamples_left(s, max_samples + unread_samples);
- if (nsamples > max_samples) {
- nsamples -= max_samples;
+ if (nsamples > unread_samples) {
+ nsamples -= unread_samples;
desc->size = comedi_samples_to_bytes(s, nsamples);
comedi_isadma_program(desc);
}