staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
commit55abe8165f31ffb83ce8b24da959b61362dca4c4
authorIan Abbott <abbotti@mev.co.uk>
Thu, 27 Oct 2016 19:28:36 +0000 (27 20:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Nov 2016 10:45:42 +0000 (7 11:45 +0100)
treeeaafbc9162d1a2e7fa143c63c3c0303ebc402bb3
parent33c027ae3cfd8fefb6cccccc5c6b2c07d80891ce
staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value

`ni_tio_clock_period_ps()` used to return the clock period in
picoseconds, and had a `BUG()` call for invalid cases.  It was changed
to pass the clock period back via a pointer parameter and return an
error for the invalid cases.  Unfortunately the code to handle
user-specified clock sources with user-specified clock period is still
returning the clock period the old way, which can lead to the caller not
getting the clock period, or seeing an unexpected error.  Fix it by
passing the clock period via the pointer parameter and returning `0`.

Fixes: b42ca86ad605 ("staging: comedi: ni_tio: remove BUG() checks for ni_tio_get_clock_src()")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_tio.c