From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C827CC43381 for ; Thu, 28 Feb 2019 12:13:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98442214D8 for ; Thu, 28 Feb 2019 12:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731584AbfB1MNY (ORCPT ); Thu, 28 Feb 2019 07:13:24 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45491 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726534AbfB1MNT (ORCPT ); Thu, 28 Feb 2019 07:13:19 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Feb 2019 14:13:14 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (dev-l-vrt-210.mtl.labs.mlnx [10.134.210.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1SCDEmI013731; Thu, 28 Feb 2019 14:13:14 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Debian-8ubuntu1) with ESMTP id x1SCDEBI015810; Thu, 28 Feb 2019 14:13:14 +0200 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id x1SCDER5015809; Thu, 28 Feb 2019 14:13:14 +0200 From: Aya Levin To: David Ahern Cc: netdev@vger.kernel.org, Jiri Pirko , Moshe Shemesh , Eran Ben Elisha , Aya Levin Subject: [PATCH v4 iproute2-next 02/11] devlink: Fix print of uint64_t Date: Thu, 28 Feb 2019 14:12:55 +0200 Message-Id: <1551355984-15752-3-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1551355984-15752-1-git-send-email-ayal@mellanox.com> References: <1551355984-15752-1-git-send-email-ayal@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch prints uint64_t with its corresponding format and avoid implicit cast to uint32_t. Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Acked-by: Jiri Pirko --- devlink/devlink.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index a774b196b7fd..8a28b5d5c26f 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1651,7 +1651,14 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val) if (val == (uint64_t) -1) return pr_out_str(dl, name, "unlimited"); - return pr_out_uint(dl, name, val); + if (dl->json_output) { + jsonw_u64_field(dl->jw, name, val); + } else { + if (g_indent_newline) + pr_out("%s %lu", name, val); + else + pr_out(" %s %lu", name, val); + } } static void pr_out_region_chunk_start(struct dl *dl, uint64_t addr) -- 2.14.1