From patchwork Fri Jun 28 13:12:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11022425 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C3DC924 for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DB8F287AA for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82258287B1; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13E38286BC for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbfF1NMW (ORCPT ); Fri, 28 Jun 2019 09:12:22 -0400 Received: from mga11.intel.com ([192.55.52.93]:24434 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbfF1NMW (ORCPT ); Fri, 28 Jun 2019 09:12:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2019 06:12:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,427,1557212400"; d="scan'208";a="314131362" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 28 Jun 2019 06:12:19 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 13F551A3; Fri, 28 Jun 2019 16:12:19 +0300 (EEST) From: Andy Shevchenko To: linux-pci@vger.kernel.org, Gustavo Pimentel Cc: Andy Shevchenko , Jean-Jacques Hiblot , Lorenzo Pieralisi , Kishon Vijay Abraham I Subject: [PATCH v1 1/2] tools: PCI: Fix compilation error Date: Fri, 28 Jun 2019 16:12:17 +0300 Message-Id: <20190628131218.10244-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit b71f0a0b1e3f ("tools: PCI: Exit with error code when test fails") forgot to update function prototype and thus brought a regression: pcitest.c:221:9: error: void value not ignored as it ought to be return run_test(test); ^~~~~~~~~~~~~~ Fix it by changing prototype from void to int. While here, initialize ret with 0 to avoid compiler warning: pcitest.c:132:25: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized] Fixes: b71f0a0b1e3f ("tools: PCI: Exit with error code when test fails") Cc: Jean-Jacques Hiblot Cc: Lorenzo Pieralisi Cc: Kishon Vijay Abraham I Signed-off-by: Andy Shevchenko --- tools/pci/pcitest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index cb7a47dfd8b6..81b89260e80f 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -36,15 +36,15 @@ struct pci_test { unsigned long size; }; -static void run_test(struct pci_test *test) +static int run_test(struct pci_test *test) { - long ret; + long ret = 0; int fd; fd = open(test->device, O_RDWR); if (fd < 0) { perror("can't open PCI Endpoint Test device"); - return; + return fd; } if (test->barnum >= 0 && test->barnum <= 5) { @@ -129,7 +129,7 @@ static void run_test(struct pci_test *test) } fflush(stdout); - return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ + return (ret < 0) ? ret : 0; /* return 0 if test succeeded */ } int main(int argc, char **argv) From patchwork Fri Jun 28 13:12:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11022427 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBB721708 for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACB1F286BC for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0715287B1; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33D0C287A8 for ; Fri, 28 Jun 2019 13:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbfF1NMW (ORCPT ); Fri, 28 Jun 2019 09:12:22 -0400 Received: from mga06.intel.com ([134.134.136.31]:39309 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbfF1NMW (ORCPT ); Fri, 28 Jun 2019 09:12:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2019 06:12:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,427,1557212400"; d="scan'208";a="167753239" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 28 Jun 2019 06:12:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2399B177; Fri, 28 Jun 2019 16:12:19 +0300 (EEST) From: Andy Shevchenko To: linux-pci@vger.kernel.org, Gustavo Pimentel Cc: Andy Shevchenko , Kishon Vijay Abraham I , Sekhar Nori , Lorenzo Pieralisi Subject: [PATCH v1 2/2] tools: PCI: Fix a typo in usage messages Date: Fri, 28 Jun 2019 16:12:18 +0300 Message-Id: <20190628131218.10244-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190628131218.10244-1-andriy.shevchenko@linux.intel.com> References: <20190628131218.10244-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the commit fbca0b284bd0 ("tools: PCI: Add 'h' in optstring of getopt()") introduced a fix to support -h command line option, it, at the same time, brought a regression to the code which produces a compile-time warning: pcitest.c:203:4: warning: too many arguments for format [-Wformat-extra-args] "usage: %s [options]\n" ^~~~~~~~~~~~~~~~~~~~~~~ Remove trailing comma to make it correct. Fixes: fbca0b284bd0 ("tools: PCI: Add 'h' in optstring of getopt()") Cc: Kishon Vijay Abraham I Cc: Sekhar Nori Cc: Lorenzo Pieralisi Signed-off-by: Andy Shevchenko --- tools/pci/pcitest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 81b89260e80f..c495e5b5fd7f 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -212,7 +212,7 @@ int main(int argc, char **argv) "\t-r Read buffer test\n" "\t-w Write buffer test\n" "\t-c Copy buffer test\n" - "\t-s Size of buffer {default: 100KB}\n", + "\t-s Size of buffer {default: 100KB}\n" "\t-h Print this help message\n", argv[0]); return -EINVAL;