From 1c53093a1dea755f5ab9598d57b78f9a9444262d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 12 Jan 2015 10:55:59 -0700 Subject: [PATCH] staging: comedi: pcl818: fix pcl818_handle_dma() for short DMA transaction Currently this function always transfers the full DMA buffer to the comedi async buffer. When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller than the buffer size. This results in invalid data being added to the asunc buffer. Add a 'size' member to the DMA descriptor and initialize it with the actual size of the DMA transfer. Use that in pcl818_handle_dma() to return the proper number of samples. Use the comedi_bytes_to_samples() helper to convert the byte size to comedi samples. Remove the unnecessary 'bufptr' local variable. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Reading git-format-patch failed