From: Damien Le Moal <dlemoal@kernel.org>
To: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Manivannan Sadhasivami <manivannan.sadhasivam@linaro.org>
Subject: [PATCH v2 1/2] PCI: endpoint: Improve pci_epf_type_add_cfs()
Date: Mon, 15 May 2023 16:43:47 +0900 [thread overview]
Message-ID: <20230515074348.595704-2-dlemoal@kernel.org> (raw)
In-Reply-To: <20230515074348.595704-1-dlemoal@kernel.org>
pci_epf_type_add_cfs() should not be called with an unbound EPF device,
that is, an epf device with epf->driver not set. For such case, replace
the NULL return in pci_epf_type_add_cfs() with a clear ERR_PTR(-ENODEV)
pointer error return.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/pci/endpoint/pci-ep-cfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
index 0fb6c376166f..0bf5be986e9b 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -516,7 +516,7 @@ static struct config_group *pci_epf_type_add_cfs(struct pci_epf *epf,
if (!epf->driver) {
dev_err(&epf->dev, "epf device not bound to driver\n");
- return NULL;
+ return ERR_PTR(-ENODEV);
}
if (!epf->driver->ops->add_cfs)
--
2.40.1
next prev parent reply other threads:[~2023-05-15 7:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 7:43 [PATCH v2 0/2] Fixup changes to pci_epf_type_add_cfs() Damien Le Moal
2023-05-15 7:43 ` Damien Le Moal [this message]
2023-05-17 7:41 ` [PATCH v2 1/2] PCI: endpoint: Improve pci_epf_type_add_cfs() Manivannan Sadhasivami
2023-05-15 7:43 ` [PATCH v2 2/2] PCI: endpoint: Add kdoc description of pci_epf_type_add_cfs() Damien Le Moal
2023-05-17 7:45 ` Manivannan Sadhasivami
2023-05-29 15:46 ` [PATCH v2 0/2] Fixup changes to pci_epf_type_add_cfs() Lorenzo Pieralisi
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=20230515074348.595704-2-dlemoal@kernel.org \
--to=dlemoal@kernel.org \
--cc=bhelgaas@google.com \
--cc=kishon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.