Skip to contentSkip to conversation

patch "staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return" added to staging-linus

PATCH [email protected] 1 participant 1 message Nov 7, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 55abe8165f31ffb83ce8b24da959b61362dca4c4 Mon Sep 17 00:00:00 2001

From: Ian Abbott <[email protected]>
Date: Thu, 27 Oct 2016 20:28:36 +0100
Subject: 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()")
Cc <[email protected]> # 4.7+
---
 drivers/staging/comedi/drivers/ni_tio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/ni_tio.c +2 -1
index 7043eb0543f6..5ab49a798164 100644
@@ -207,7 +207,8 @@ static int ni_tio_clock_period_ps(const struct ni_gpct *counter,
 		 * clock period is specified by user with prescaling
 		 * already taken into account.
 		 */
-		return counter->clock_period_ps;
+		*period_ps = counter->clock_period_ps;
+		return 0;
 	}
 
 	switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) {
Signature · 1 line
2.10.2