staging: comedi: adl_pci9118: tidy up pci9118_ai_setup_dma()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 19 Oct 2015 20:13:05 +0000 (13:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:17:13 +0000 (19:17 -0700)
commiteb96c7fc24fb89d7e3382260e1b391c05895cfa6
tree405279629145bafad8b318a6832e6a52aa214bc6
parent45037a9569183b49a9c9cf9faea294228c3963d2
staging: comedi: adl_pci9118: tidy up pci9118_ai_setup_dma()

For aesthetics, init the dmalen[01] local variables when they are declared.

Use a local variable, 'scan_bytes', for the (devpriv->ai_n_realscanlen << 1)
calculation. For aesthetics and clarification, use comedi_bytes_per_sample()
instead of the '<< 1' shift to calculate the value.

The local variable 'i' is badly named. Remove it and use a local variable
'tmp' where it is used.

When checking the DMA buffer lengths for non-neverending commands the
scan length calculation, (devpriv->ai_n_realscanlen << 1) * cmd->stop_arg,
could overflow. Use and unsigned long long local variable to hold the
calculation and avoid the overflow.

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>
drivers/staging/comedi/drivers/adl_pci9118.c
This page took 0.024447 seconds and 5 git commands to generate.