From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.136]:58202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223AbcHPVCj (ORCPT ); Tue, 16 Aug 2016 17:02:39 -0400 Date: Tue, 16 Aug 2016 16:01:49 -0500 From: Bjorn Helgaas To: Shawn Lin Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs Message-ID: <20160816210149.GA14976@localhost> References: <1466565620-27183-1-git-send-email-shawn.lin@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1466565620-27183-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-pci-owner@vger.kernel.org List-ID: 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 > > --- > > 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