From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
To: rick.wertenbroek@heig-vd.ch
Cc: dlemoal@kernel.org,
"Rick Wertenbroek" <rick.wertenbroek@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PCI: endpoint: Return error code when callback is not implemented
Date: Thu, 17 Aug 2023 15:33:41 +0200 [thread overview]
Message-ID: <20230817133341.212747-1-rick.wertenbroek@gmail.com> (raw)
Return an error code when the callback for an endpoint controller
function is not implemented (is null). Among all the functions, only
map_msi_irq() had an error returned if the callback was null. Extend
this error handling to other functions as well.
Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
---
drivers/pci/endpoint/pci-epc-core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 5a4a8b0be626..14f4256b9410 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -196,7 +196,7 @@ int pci_epc_start(struct pci_epc *epc)
return -EINVAL;
if (!epc->ops->start)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->start(epc);
@@ -228,7 +228,7 @@ int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
return -EINVAL;
if (!epc->ops->raise_irq)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->raise_irq(epc, func_no, vfunc_no, type, interrupt_num);
@@ -340,7 +340,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
return -EINVAL;
if (!epc->ops->set_msi)
- return 0;
+ return -EINVAL;
encode_int = order_base_2(interrupts);
@@ -408,7 +408,7 @@ int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
return -EINVAL;
if (!epc->ops->set_msix)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->set_msix(epc, func_no, vfunc_no, interrupts - 1, bir,
@@ -469,7 +469,7 @@ int pci_epc_map_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
return -EINVAL;
if (!epc->ops->map_addr)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->map_addr(epc, func_no, vfunc_no, phys_addr, pci_addr,
@@ -537,7 +537,7 @@ int pci_epc_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
return -EINVAL;
if (!epc->ops->set_bar)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->set_bar(epc, func_no, vfunc_no, epf_bar);
@@ -575,7 +575,7 @@ int pci_epc_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
return -EINVAL;
if (!epc->ops->write_header)
- return 0;
+ return -EINVAL;
mutex_lock(&epc->lock);
ret = epc->ops->write_header(epc, func_no, vfunc_no, header);
--
2.25.1
next reply other threads:[~2023-08-17 13:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 13:33 Rick Wertenbroek [this message]
2023-08-18 2:51 ` [PATCH] PCI: endpoint: Return error code when callback is not implemented Damien Le Moal
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=20230817133341.212747-1-rick.wertenbroek@gmail.com \
--to=rick.wertenbroek@gmail.com \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=rick.wertenbroek@heig-vd.ch \
/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;
as well as URLs for NNTP newsgroup(s).