From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: kw@linux.com, gregkh@linuxfoundation.org, arnd@arndb.de,
lpieralisi@kernel.org, shuah@kernel.org, kishon@kernel.org,
aman1.gupta@samsung.com, p.rajanbabu@samsung.com,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
bhelgaas@google.com, linux-arm-msm@vger.kernel.org,
robh@kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 2/4] misc: pci_endpoint_test: Fix the return value of IOCTL
Date: Fri, 29 Nov 2024 22:00:24 +0530 [thread overview]
Message-ID: <20241129163024.dvz2ojldopeoyr6c@thinkpad> (raw)
In-Reply-To: <ccd1587a-0368-4bde-9c72-4f10393c58b0@kernel.org>
On Fri, Nov 29, 2024 at 07:51:30PM +0900, Damien Le Moal wrote:
> On 11/29/24 18:24, Manivannan Sadhasivam wrote:
> > IOCTLs are supposed to return 0 for success and negative error codes for
> > failure. Currently, this driver is returning 0 for failure and 1 for
> > success, that's not correct. Hence, fix it!
> >
> > Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Closes: https://lore.kernel.org/all/YvzNg5ROnxEApDgS@kroah.com
> > Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device")
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>
> Looks OK to me.
>
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
>
> One nit below.
>
> [...]
>
> > static void pci_endpoint_test_remove(struct pci_dev *pdev)
> > diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
> > index 470258009ddc..545e04ad63a2 100644
> > --- a/tools/pci/pcitest.c
> > +++ b/tools/pci/pcitest.c
> > @@ -16,7 +16,6 @@
> >
> > #include <linux/pcitest.h>
> >
> > -static char *result[] = { "NOT OKAY", "OKAY" };
> > static char *irq[] = { "LEGACY", "MSI", "MSI-X" };
> >
> > struct pci_test {
> > @@ -52,63 +51,65 @@ static int run_test(struct pci_test *test)
> > ret = ioctl(fd, PCITEST_BAR, test->barnum);
> > fprintf(stdout, "BAR%d:\t\t", test->barnum);
> > if (ret < 0)
> > - fprintf(stdout, "TEST FAILED\n");
> > + fprintf(stdout, "NOT OKAY\n");
> > else
> > - fprintf(stdout, "%s\n", result[ret]);
> > + fprintf(stdout, "OKAY\n");
>
> Maybe replace all this "if (ret < 0) ... else ..." and all the ones below with
> something a call to:
>
> static void test_result(int ret)
> {
> fprintf(stdout, "%sOKAY\n", ret < 0 ? "NOT " : "");
> }
>
> or simply with the call:
>
> fprintf(stdout, "%sOKAY\n", ret < 0 ? "NOT " : "");
>
> to avoid all these repetition.
>
Sounds good to me. Will incorporate in next version, thanks!
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-11-29 16:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 9:24 [PATCH v2 0/4] Migrate PCI Endpoint Subsystem tests to Kselftest Manivannan Sadhasivam
2024-11-29 9:24 ` [PATCH v2 1/4] PCI: qcom-ep: Mark BAR0/BAR2 as 64bit BARs and BAR1/BAR3 as RESERVED Manivannan Sadhasivam
2024-11-29 14:38 ` Dmitry Baryshkov
2024-11-29 19:55 ` Bjorn Helgaas
2024-11-30 16:17 ` Greg KH
2024-12-02 12:58 ` Manivannan Sadhasivam
2024-12-02 17:40 ` Bjorn Helgaas
2024-11-29 9:24 ` [PATCH v2 2/4] misc: pci_endpoint_test: Fix the return value of IOCTL Manivannan Sadhasivam
2024-11-29 10:51 ` Damien Le Moal
2024-11-29 16:30 ` Manivannan Sadhasivam [this message]
2024-12-11 7:47 ` Manivannan Sadhasivam
2024-11-29 9:24 ` [PATCH v2 3/4] selftests: Move PCI Endpoint tests from tools/pci to Kselftests Manivannan Sadhasivam
2024-11-29 9:24 ` [PATCH v2 4/4] selftests: pci_endpoint: Migrate to Kselftest framework Manivannan Sadhasivam
2024-11-29 13:51 ` Niklas Cassel
2024-11-29 16:35 ` Manivannan Sadhasivam
2024-11-29 16:42 ` Niklas Cassel
2024-11-29 16:52 ` Manivannan Sadhasivam
2024-11-29 17:13 ` Niklas Cassel
2024-11-29 18:25 ` Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241129163024.dvz2ojldopeoyr6c@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=aman1.gupta@samsung.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=p.rajanbabu@samsung.com \
--cc=robh@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox