diff options
author | Robert Richter <robert.richter@amd.com> | 2009-07-15 15:44:18 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-07-20 16:43:18 +0200 |
commit | 2051cade7ccbe45a8bf8b7809d56b23d6d75ad03 (patch) | |
tree | 6c3e1973ac658f4db220ee5bbf9f770f504e210c /drivers/oprofile | |
parent | 6bfccd099c2841e1c42530f1b6d2553bfa13be3a (diff) | |
download | linux-2051cade7ccbe45a8bf8b7809d56b23d6d75ad03.tar.bz2 |
oprofile: oprofile_set_timeout(), return with error for invalid args
Return with -EINVAL for invalid parameters instead of setting the
default value in oprofile_set_timeout().
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile')
-rw-r--r-- | drivers/oprofile/oprof.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index 7bc64af7cf99..42c9c765f9f1 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c @@ -196,6 +196,7 @@ post_sync: int oprofile_set_timeout(unsigned long val_msec) { int err = 0; + unsigned long time_slice; mutex_lock(&start_mutex); @@ -209,9 +210,13 @@ int oprofile_set_timeout(unsigned long val_msec) goto out; } - timeout_jiffies = msecs_to_jiffies(val_msec); - if (timeout_jiffies == MAX_JIFFY_OFFSET) - timeout_jiffies = msecs_to_jiffies(MULTIPLEXING_TIMER_DEFAULT); + time_slice = msecs_to_jiffies(val_msec); + if (time_slice == MAX_JIFFY_OFFSET) { + err = -EINVAL; + goto out; + } + + timeout_jiffies = time_slice; out: mutex_unlock(&start_mutex); |