tools: PCI: Fix compilation error
PATCH 1/2 tools: PCI: Fix compilation error
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]
--- tools/pci/pcitest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/pci/pcitest.c +4 -4
@@ -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)
Signature · 1 line
2.20.1
PATCH 2/2 tools: PCI: Fix a typo in usage messages
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.
--- tools/pci/pcitest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/pci/pcitest.c +1 -1
@@ -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 ;
Signature · 1 line
2.20.1
Quoted 16 lines · Andy Shevchenko
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]
Quoted 8 lines
Fixes b71f0a0b1e3f ("tools: PCI: Exit with error code when test fails")Cc Jean-Jacques Hiblot <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- 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/[email protected]/
Thanks anyway !
Lorenzo
Quoted 35 lines
tools/pci/pcitest.c +4
-4@@ -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)Signature · 1 line
2.20.1
Quoted 26 lines · Lorenzo Pieralisi
Quoted 16 lines · Andy Shevchenko
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]
Quoted 8 lines
Fixes b71f0a0b1e3f ("tools: PCI: Exit with error code when test fails")Cc Jean-Jacques Hiblot <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- tools/pci/pcitest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 5 lines
Patch 1 and 2 already applied from another thread:
https://lore.kernel.org/linux-pci/[email protected]/
Thanks anyway !
I don't see neither in v5.2-rc7, nor in Linux Next. In which repository is it?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 27 lines · Andy Shevchenko
Quoted 26 lines · Lorenzo Pieralisi
Quoted 24 lines · Andy Shevchenko
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 <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- tools/pci/pcitest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 8 lines
Quoted 5 lines
Patch 1 and 2 already applied from another thread:
https://lore.kernel.org/linux-pci/[email protected]/
Thanks anyway !
I don't see neither in v5.2-rc7, nor in Linux Next. In which repository is it?
It is in -next:
Quoted 32 lines · Lorenzo Pieralisi
Quoted 31 lines · Andy Shevchenko
Quoted 30 lines · Lorenzo Pieralisi
Quoted 16 lines · Andy Shevchenko
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]
Quoted 8 lines
Fixes b71f0a0b1e3f ("tools: PCI: Exit with error code when test fails")Cc Jean-Jacques Hiblot <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- tools/pci/pcitest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Patch 1 and 2 already applied from another thread:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Thanks anyway !
I don't see neither in v5.2-rc7, nor in Linux Next. In which repository is it?
It is in -next:
Ah, thanks. It seems I forgot to update my local branch.
Signature · 2 lines
With Best Regards, Andy Shevchenko