* [PATCH v1 1/2] tools: PCI: Fix compilation error
@ 2019-06-28 13:12 Andy Shevchenko
2019-06-28 13:12 ` [PATCH v1 2/2] tools: PCI: Fix a typo in usage messages Andy Shevchenko
2019-07-05 13:34 ` [PATCH v1 1/2] tools: PCI: Fix compilation error Lorenzo Pieralisi
0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-06-28 13:12 UTC (permalink / raw)
To: linux-pci, Gustavo Pimentel
Cc: Andy Shevchenko, Jean-Jacques Hiblot, Lorenzo Pieralisi,
Kishon Vijay Abraham I
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 <jjhiblot@ti.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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)
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v1 2/2] tools: PCI: Fix a typo in usage messages
2019-06-28 13:12 [PATCH v1 1/2] tools: PCI: Fix compilation error Andy Shevchenko
@ 2019-06-28 13:12 ` Andy Shevchenko
2019-07-05 13:34 ` [PATCH v1 1/2] tools: PCI: Fix compilation error Lorenzo Pieralisi
1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-06-28 13:12 UTC (permalink / raw)
To: linux-pci, Gustavo Pimentel
Cc: Andy Shevchenko, Kishon Vijay Abraham I, Sekhar Nori,
Lorenzo Pieralisi
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 <kishon@ti.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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> Size of buffer {default: 100KB}\n",
+ "\t-s <size> Size of buffer {default: 100KB}\n"
"\t-h Print this help message\n",
argv[0]);
return -EINVAL;
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/2] tools: PCI: Fix compilation error
2019-06-28 13:12 [PATCH v1 1/2] tools: PCI: Fix compilation error Andy Shevchenko
2019-06-28 13:12 ` [PATCH v1 2/2] tools: PCI: Fix a typo in usage messages Andy Shevchenko
@ 2019-07-05 13:34 ` Lorenzo Pieralisi
2019-07-05 14:21 ` Andy Shevchenko
1 sibling, 1 reply; 6+ messages in thread
From: Lorenzo Pieralisi @ 2019-07-05 13:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-pci, Gustavo Pimentel, Jean-Jacques Hiblot,
Kishon Vijay Abraham I
On Fri, Jun 28, 2019 at 04:12:17PM +0300, Andy Shevchenko wrote:
> 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 <jjhiblot@ti.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> tools/pci/pcitest.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Patch 1 and 2 already applied from another thread:
https://lore.kernel.org/linux-pci/1558646281-12676-1-git-send-email-alan.mikhak@sifive.com/
Thanks anyway !
Lorenzo
> 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)
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/2] tools: PCI: Fix compilation error
2019-07-05 13:34 ` [PATCH v1 1/2] tools: PCI: Fix compilation error Lorenzo Pieralisi
@ 2019-07-05 14:21 ` Andy Shevchenko
2019-07-05 15:04 ` Lorenzo Pieralisi
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2019-07-05 14:21 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: linux-pci, Gustavo Pimentel, Jean-Jacques Hiblot,
Kishon Vijay Abraham I
On Fri, Jul 05, 2019 at 02:34:41PM +0100, Lorenzo Pieralisi wrote:
> On Fri, Jun 28, 2019 at 04:12:17PM +0300, Andy Shevchenko wrote:
> > 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 <jjhiblot@ti.com>
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > tools/pci/pcitest.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
>
> Patch 1 and 2 already applied from another thread:
>
> https://lore.kernel.org/linux-pci/1558646281-12676-1-git-send-email-alan.mikhak@sifive.com/
>
> Thanks anyway !
I don't see neither in v5.2-rc7, nor in Linux Next.
In which repository is it?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/2] tools: PCI: Fix compilation error
2019-07-05 14:21 ` Andy Shevchenko
@ 2019-07-05 15:04 ` Lorenzo Pieralisi
2019-07-05 15:49 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Pieralisi @ 2019-07-05 15:04 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-pci, Gustavo Pimentel, Jean-Jacques Hiblot,
Kishon Vijay Abraham I
On Fri, Jul 05, 2019 at 05:21:47PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 05, 2019 at 02:34:41PM +0100, Lorenzo Pieralisi wrote:
> > On Fri, Jun 28, 2019 at 04:12:17PM +0300, Andy Shevchenko wrote:
> > > 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 <jjhiblot@ti.com>
> > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > > tools/pci/pcitest.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > Patch 1 and 2 already applied from another thread:
> >
> > https://lore.kernel.org/linux-pci/1558646281-12676-1-git-send-email-alan.mikhak@sifive.com/
> >
> > Thanks anyway !
>
> I don't see neither in v5.2-rc7, nor in Linux Next.
> In which repository is it?
It is in -next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/tools/pci/pcitest.c?h=next-20190705
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/2] tools: PCI: Fix compilation error
2019-07-05 15:04 ` Lorenzo Pieralisi
@ 2019-07-05 15:49 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-07-05 15:49 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: linux-pci, Gustavo Pimentel, Jean-Jacques Hiblot,
Kishon Vijay Abraham I
On Fri, Jul 05, 2019 at 04:04:12PM +0100, Lorenzo Pieralisi wrote:
> On Fri, Jul 05, 2019 at 05:21:47PM +0300, Andy Shevchenko wrote:
> > On Fri, Jul 05, 2019 at 02:34:41PM +0100, Lorenzo Pieralisi wrote:
> > > On Fri, Jun 28, 2019 at 04:12:17PM +0300, Andy Shevchenko wrote:
> > > > 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 <jjhiblot@ti.com>
> > > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > ---
> > > > tools/pci/pcitest.c | 8 ++++----
> > > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > Patch 1 and 2 already applied from another thread:
> > >
> > > https://lore.kernel.org/linux-pci/1558646281-12676-1-git-send-email-alan.mikhak@sifive.com/
> > >
> > > Thanks anyway !
> >
> > I don't see neither in v5.2-rc7, nor in Linux Next.
> > In which repository is it?
>
> It is in -next:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/tools/pci/pcitest.c?h=next-20190705
Ah, thanks. It seems I forgot to update my local branch.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-07-05 15:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28 13:12 [PATCH v1 1/2] tools: PCI: Fix compilation error Andy Shevchenko
2019-06-28 13:12 ` [PATCH v1 2/2] tools: PCI: Fix a typo in usage messages Andy Shevchenko
2019-07-05 13:34 ` [PATCH v1 1/2] tools: PCI: Fix compilation error Lorenzo Pieralisi
2019-07-05 14:21 ` Andy Shevchenko
2019-07-05 15:04 ` Lorenzo Pieralisi
2019-07-05 15:49 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox