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>
This commit is contained in:
parent
6bfccd099c
commit
2051cade7c
1 changed files with 8 additions and 3 deletions
|
@ -196,6 +196,7 @@ void oprofile_shutdown(void)
|
||||||
int oprofile_set_timeout(unsigned long val_msec)
|
int oprofile_set_timeout(unsigned long val_msec)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
unsigned long time_slice;
|
||||||
|
|
||||||
mutex_lock(&start_mutex);
|
mutex_lock(&start_mutex);
|
||||||
|
|
||||||
|
@ -209,9 +210,13 @@ int oprofile_set_timeout(unsigned long val_msec)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout_jiffies = msecs_to_jiffies(val_msec);
|
time_slice = msecs_to_jiffies(val_msec);
|
||||||
if (timeout_jiffies == MAX_JIFFY_OFFSET)
|
if (time_slice == MAX_JIFFY_OFFSET) {
|
||||||
timeout_jiffies = msecs_to_jiffies(MULTIPLEXING_TIMER_DEFAULT);
|
err = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout_jiffies = time_slice;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&start_mutex);
|
mutex_unlock(&start_mutex);
|
||||||
|
|
Loading…
Reference in a new issue