Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755007AbdIHMFT (ORCPT ); Fri, 8 Sep 2017 08:05:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754878AbdIHMFQ (ORCPT ); Fri, 8 Sep 2017 08:05:16 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 404C880484 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=jolsa@kernel.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 404C880484 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Peter Zijlstra Subject: [PATCH 1/4] perf ui progress: Make sure we always define step value Date: Fri, 8 Sep 2017 14:05:07 +0200 Message-Id: <20170908120510.22515-2-jolsa@kernel.org> In-Reply-To: <20170908120510.22515-1-jolsa@kernel.org> References: <20170908120510.22515-1-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 08 Sep 2017 12:05:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 939 Lines: 28 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. Link: http://lkml.kernel.org/n/tip-0zcvhmsmbhkfgoi7c670rq2x@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/ui/progress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.9.5