Skip to content

Commit

Permalink
oprofile: oprofile_set_timeout(), return with error for invalid args
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Richter committed Jul 20, 2009
1 parent 6bfccd0 commit 2051cad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/oprofile/oprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void oprofile_shutdown(void)
int oprofile_set_timeout(unsigned long val_msec)
{
int err = 0;
unsigned long time_slice;

mutex_lock(&start_mutex);

Expand All @@ -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);
Expand Down

0 comments on commit 2051cad

Please sign in to comment.