From patchwork Thu Apr 23 21:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 210071 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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 CD0DAC54FCB for ; Thu, 23 Apr 2020 21:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A46E320857 for ; Thu, 23 Apr 2020 21:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TLBKjNX9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgDWVKt (ORCPT ); Thu, 23 Apr 2020 17:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgDWVKs (ORCPT ); Thu, 23 Apr 2020 17:10:48 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C37C09B042 for ; Thu, 23 Apr 2020 14:10:47 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id fu13so2426582pjb.5 for ; Thu, 23 Apr 2020 14:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=odzY2H9MOg6XnqWqH3v4/StHWBLH4+8YutE666x3msg=; b=TLBKjNX9AbFhEZefKEvLa/tPyDAUfY2dMDu0CacKPYtnkRJof+yoM9oZ+yO5Wwa74k eYC2i4OeOURIUEX4sTtBder8LAs9W0AG4bCgi53kA5gFHy/UUD73dTY50i+ANj5fLjn4 p664rRG46pgi0mG16QtbPTg3O/7yGAUVdD3YcVoAqBmGzDpWXmXODMLlFfi7mIUYW8T1 dc+Z3Gh2C790So1mgCp+1wstnCCjkkUkrAfw6ZNfWATmF7Ez6XHjcFS7YorqPNs8K1QZ 9VByE6OVSn2G4dwxDOf1C6M7qa4Jxxbn4Jhb/cxzRQ7HLPomycZ+D8BoxRWaBqF6koKe TO+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=odzY2H9MOg6XnqWqH3v4/StHWBLH4+8YutE666x3msg=; b=P6XlAu0HD2OHjN3Y3VAxwxnmEiMnQUVEf3N47FDsERQTMbbd0dipWdG45gTGasHhMO Y+Sg6tkSIe5ANePkTaUAQpz0/OIDvZKp90N/GFtJFbz5bk7RHByPl7lpXVN8+JOv0j78 etnDyaoRX1xeox93Oio/Ry/FI1cPXqN0qX2lwh6rF1iqjMXzKF9S+AbRLVk5pCEr9Jah sYGawcFql//gq9eyKbIGZMKygRUgPVquz7gn50UsqLZdDM0Xe5TID7cRdxnsBAA8zt0t 72yaFVI5GF922/qE1gfVf5Ml0qsqWmTpAu1fOdSeXprKPLVPk8vBttycj/x1us2uFmTl 7Krg== X-Gm-Message-State: AGi0PuateK401Rg3s0xsXwAh9j5GBpACirVgRLO25vPR7nw/g7oMkARW YXp4KKVSAoS9LlAb9AmWt6sTSn3v X-Google-Smtp-Source: APiQypK2Ky/H+eIc5LwOXyx4RRMvDDK4iarTk9d/2BK16WbXRSMtPyasziIamHVz7jdpTqAXg4VVmw== X-Received: by 2002:a17:902:ac87:: with SMTP id h7mr5452209plr.119.1587676246175; Thu, 23 Apr 2020 14:10:46 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:45 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 2/5] utils: add noreturn attribute and remove dead code Date: Thu, 23 Apr 2020 14:10:37 -0700 Message-Id: <20200423211040.14275-2-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with -Wmissing-noreturn and -Wunreachable-code-return Signed-off-by: Rosen Penev --- utils/v4l2-compliance/v4l2-compliance.cpp | 10 +++++----- utils/v4l2-dbg/v4l2-dbg.cpp | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index b3a18492..a312f54d 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -247,7 +247,6 @@ static void usage() printf(" -w, --wrapper Use the libv4l2 wrapper library.\n"); #endif printf(" -W, --exit-on-warn Exit on the first warning.\n"); - exit(0); } const char *ok(int res) @@ -482,6 +481,7 @@ static void restoreState() node->reopen(); } +__attribute__((noreturn)) static void signal_handler_interrupt(int signum) { restoreState(); @@ -1544,7 +1544,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = make_devname(optarg, "video", media_bus_info); break; @@ -1669,13 +1669,13 @@ int main(int argc, char **argv) fprintf(stderr, "Option `%s' requires a value\n", argv[optind]); usage(); - return 1; + exit(1); case '?': if (argv[optind]) fprintf(stderr, "Unknown argument `%s'\n", argv[optind]); usage(); - return 1; + exit(1); } } if (optind < argc) { @@ -1684,7 +1684,7 @@ int main(int argc, char **argv) fprintf(stderr, "%s ", argv[optind++]); fprintf(stderr, "\n"); usage(); - return 1; + exit(1); } bool direct = !options[OptUseWrapper]; int fd; diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index cd387d1d..99c5a726 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -187,7 +187,6 @@ static void usage() " Sets step between two registers\n" " --list-symbols List the symbolic register names you can use, if any\n" " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); - exit(0); } static std::string cap2s(unsigned cap) @@ -429,7 +428,7 @@ int main(int argc, char **argv) if (argc == 1) { usage(); - return 0; + exit(0); } for (i = 0; long_options[i].name; i++) { if (!isalpha(long_options[i].val)) @@ -467,7 +466,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = optarg; From patchwork Thu Apr 23 21:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 210070 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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 044BFC54FCB for ; Thu, 23 Apr 2020 21:10:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CED662084D for ; Thu, 23 Apr 2020 21:10:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ap8Wkfne" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbgDWVKz (ORCPT ); Thu, 23 Apr 2020 17:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbgDWVKy (ORCPT ); Thu, 23 Apr 2020 17:10:54 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DD3C09B042 for ; Thu, 23 Apr 2020 14:10:53 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id z1so1918943pfn.3 for ; Thu, 23 Apr 2020 14:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mao265vqR3DSfNevTKL5tM2C8pyH2zCIE1IOHDhO9sY=; b=ap8WkfneMwYDbwaLUrB+PKEEQhK9MJRCSXn5c/EyFGJwhBgY+kYKFYor50/ae85HgG 6yO4qFFUnW9Xg8M8bNb8Sw4LsYBiKiTNSrZ3MRHQd4AFllASxuHWrxkE8+XMiK3lnbLP 2nC9whcAJyHrKv/OYNdJk4AU6IR+hL7CUga1/pwPTIV6snCeqKKzC8OcnsM1KFRP6u9e h/+G2zT1OcDzXBK+Qm7GuTU+78K91rFNA+ejlC7bVCkodz40h34y5+uRLMipYlaZdr+v +C1cnmlRfDSkRiG+1nzaVWUkEpc+vw2juM279GpQlTV9GHn7Cv3FisYN7CIu5J1bXwlA gJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mao265vqR3DSfNevTKL5tM2C8pyH2zCIE1IOHDhO9sY=; b=jWkVKYBkizDfygqI03hxBMVfl5nW/gcmG0DPfTrjNwZz454Y9sYAtOHHl7n02FlxBp pdpdXZbOoBMr8Noc3PuHrpHjmHUUN981JjLlLw72cpvGvIPNyRLukfsHV38ApLnmJXd/ 2mklvmVp1VISasCbUMMw7rcz0/4KvXxgwhs1wmnRDi7NYZEj0tEnoihYQ9iJpKx9rI81 j1bx4A0ZQ56XAQecf2y3TMxIVgTMHa8jHT9yDgm0YLsu+bXvmB3r/6RuNRWQUnnDeVVc KdB0Ik1mDc8QhM2/ZQHbx3vE8zQycth5plCA9OkxaPrpkJeBnaS6K8a9NgXq9V2Ta8nV reww== X-Gm-Message-State: AGi0PubxdBGMMfMsW3axrQY/vvjhUV6gYEROO6XPrtGM8nxwsIL+wc6U 6kfRy3yR6/FNsYft5gtVWmgvHRhZ X-Google-Smtp-Source: APiQypKOrUnbtkuXnCCrAOzLyn5KVi6SQYaxF4U0inyJFffxjOv9u6Q055BGVc1ig0xDySWz53XZpQ== X-Received: by 2002:a63:b954:: with SMTP id v20mr5503697pgo.100.1587676252620; Thu, 23 Apr 2020 14:10:52 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:52 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 5/5] utils: fix double promotions Date: Thu, 23 Apr 2020 14:10:40 -0700 Message-Id: <20200423211040.14275-5-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with -Wdouble-promotion Signed-off-by: Rosen Penev --- utils/rds-ctl/rds-ctl.cpp | 4 ++-- utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 0e497b2a..558f5d76 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -521,7 +521,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) printf("received blocks / received groups: %u / %u\n", statistics->block_cnt, statistics->group_cnt); - float block_error_percentage = 0; + double block_error_percentage = 0; if (statistics->block_cnt) block_error_percentage = @@ -530,7 +530,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) statistics->block_error_cnt, block_error_percentage, statistics->group_error_cnt); - float block_corrected_percentage = 0; + double block_corrected_percentage = 0; if (statistics->block_cnt) block_corrected_percentage = ( diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 561a3376..26947724 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -2597,7 +2597,7 @@ static void streamFmt(struct node *node, __u32 pixelformat, __u32 w, __u32 h, char hz[32] = ""; if (!frame_count) - frame_count = f ? static_cast(1.0f / fract2f(f)) : 10; + frame_count = f ? static_cast(1.0 / fract2f(f)) : 10; node->g_fmt(fmt); fmt.s_pixelformat(pixelformat); fmt.s_width(w);