]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
authorIan Abbott <abbotti@mev.co.uk>
Thu, 27 Oct 2016 19:28:36 +0000 (20:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:46 +0000 (10:51 +0100)
commitdea774aac05496fd51a172ec2f658b73d45705ec
treeb0fc7f631351514a247ec56c3f2b97486a463c0b
parent5d510185f99aec70339ad5ebf97b1176dc4bf29b
staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value

commit 55abe8165f31ffb83ce8b24da959b61362dca4c4 upstream.

`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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_tio.c