diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-09-08 14:05:07 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-09-12 12:34:46 -0300 |
commit | 4d286c89e412fc2eaa1b8988481d2f32b5e3826f (patch) | |
tree | 84bbfd172257b0a4fb79f798d193627eb7ccd7bb /tools | |
parent | cd6379ebb55ae53e77f17e22ce830bf3fe826736 (diff) | |
download | linux-4d286c89e412fc2eaa1b8988481d2f32b5e3826f.tar.bz2 |
perf ui progress: Make sure we always define step value
Unlikely, but we could have ui_progress__init being called with total <
16, which would set the next and step variables to 0. That would force
unnecessary ui_progress__ops->update calls because 'next' would never
raise.
Forcing the next and step values to be always > 0.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170908120510.22515-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/progress.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c index a0f24c7115c5..a9c15804b1f6 100644 --- a/tools/perf/ui/progress.c +++ b/tools/perf/ui/progress.c @@ -25,7 +25,7 @@ void ui_progress__update(struct ui_progress *p, u64 adv) void ui_progress__init(struct ui_progress *p, u64 total, const char *title) { p->curr = 0; - p->next = p->step = total / 16; + p->next = p->step = total / 16 ?: 1; p->total = total; p->title = title; |