Skip to content

Commit 55abe81

Browse files
ian-abbottgregkh
authored andcommitted
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: b42ca86 ("staging: comedi: ni_tio: remove BUG() checks for ni_tio_get_clock_src()") Signed-off-by: Ian Abbott <[email protected]> Cc: <[email protected]> # 4.7+ Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 33c027a commit 55abe81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/staging/comedi/drivers/ni_tio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ static int ni_tio_clock_period_ps(const struct ni_gpct *counter,
207207
* clock period is specified by user with prescaling
208208
* already taken into account.
209209
*/
210-
return counter->clock_period_ps;
210+
*period_ps = counter->clock_period_ps;
211+
return 0;
211212
}
212213

213214
switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) {

0 commit comments

Comments
 (0)