* [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs
@ 2016-06-22 3:20 Shawn Lin
2016-08-16 21:01 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Lin @ 2016-06-22 3:20 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Shawn Lin
No any callers do care whether arch_setup_msi_irqs returns
-ENOSPC or other error numbers. That means they treat the
negative numbers in the same way. So there shouldn't make any
difference to directly return -ENOSPC if finding it's non-zero.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v2:
- fix warning generated by -Wmisleading-indentation reported by Kbuild robot
drivers/pci/msi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index a080f44..5057219 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -108,7 +108,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
struct msi_controller *chip = dev->bus->msi;
struct msi_desc *entry;
- int ret;
+ int ret = 0;
if (chip && chip->setup_irqs)
return chip->setup_irqs(chip, dev, nvec, type);
@@ -121,9 +121,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
for_each_pci_msi_entry(entry, dev) {
ret = arch_setup_msi_irq(dev, entry);
- if (ret < 0)
- return ret;
- if (ret > 0)
+ if (ret)
return -ENOSPC;
}
--
2.3.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs
2016-06-22 3:20 [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs Shawn Lin
@ 2016-08-16 21:01 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2016-08-16 21:01 UTC (permalink / raw)
To: Shawn Lin; +Cc: Bjorn Helgaas, linux-pci, linux-kernel
On Wed, Jun 22, 2016 at 11:20:20AM +0800, Shawn Lin wrote:
> No any callers do care whether arch_setup_msi_irqs returns
> -ENOSPC or other error numbers. That means they treat the
> negative numbers in the same way. So there shouldn't make any
> difference to directly return -ENOSPC if finding it's non-zero.
This return value gets returned all the way up to the external
interfaces used by drivers, e.g., pci_enable_msi_range(), so it would
take quite a lot of analysis to assert that *no* caller cares whether
it's -ENOSPC or something else. I suspect you're right that it
probably doesn't matter, but it looks pretty hard to prove it.
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> Changes in v2:
> - fix warning generated by -Wmisleading-indentation reported by Kbuild robot
>
> drivers/pci/msi.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index a080f44..5057219 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -108,7 +108,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> {
> struct msi_controller *chip = dev->bus->msi;
> struct msi_desc *entry;
> - int ret;
> + int ret = 0;
I don't think this initialization is necessary.
> if (chip && chip->setup_irqs)
> return chip->setup_irqs(chip, dev, nvec, type);
> @@ -121,9 +121,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>
> for_each_pci_msi_entry(entry, dev) {
> ret = arch_setup_msi_irq(dev, entry);
> - if (ret < 0)
> - return ret;
> - if (ret > 0)
> + if (ret)
> return -ENOSPC;
> }
>
> --
> 2.3.7
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-16 21:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 3:20 [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs Shawn Lin
2016-08-16 21:01 ` Bjorn Helgaas
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).