diff mbox

[-next] PCI: endpoint: functions: Fix return value check in pci_epf_test_probe()

Message ID 20170428085548.15942-1-weiyj.lk@gmail.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Wei Yongjun April 28, 2017, 8:55 a.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

Fix the return value check which testing the wrong variable
in pci_epf_test_probe().

Fixes: 79ba640e377b ("PCI: endpoint: functions: Add an EP function
to test PCI")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Helgaas April 28, 2017, 3:25 p.m. UTC | #1
On Fri, Apr 28, 2017 at 3:55 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Fix the return value check which testing the wrong variable
> in pci_epf_test_probe().
>
> Fixes: 79ba640e377b ("PCI: endpoint: functions: Add an EP function
> to test PCI")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

This fix looks obviously correct, so I folded it into the original
commit for v4.12.  Thanks!

> ---
>  drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index d6a7a12..53fff80 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -441,7 +441,7 @@ static int pci_epf_test_probe(struct pci_epf *epf)
>         struct device *dev = &epf->dev;
>
>         epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL);
> -       if (!epf)
> +       if (!epf_test)
>                 return -ENOMEM;
>
>         epf->header = &test_header;
>
diff mbox

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index d6a7a12..53fff80 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -441,7 +441,7 @@  static int pci_epf_test_probe(struct pci_epf *epf)
 	struct device *dev = &epf->dev;
 
 	epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL);
-	if (!epf)
+	if (!epf_test)
 		return -ENOMEM;
 
 	epf->header = &test_header;