瀏覽代碼

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>
H Hartley Sweeten 10 年之前
父節點
當前提交
fd27ae76d2
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/staging/comedi/drivers/pcl812.c

+ 2 - 2
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);
 	}