From patchwork Wed Jun 22 02:18:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9191721 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8735D6075A for ; Wed, 22 Jun 2016 02:20:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7446B1FF12 for ; Wed, 22 Jun 2016 02:20:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 656EF28319; Wed, 22 Jun 2016 02:20:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A6ED1FF12 for ; Wed, 22 Jun 2016 02:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbcFVCUJ (ORCPT ); Tue, 21 Jun 2016 22:20:09 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:34899 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbcFVCUI (ORCPT ); Tue, 21 Jun 2016 22:20:08 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.140]) by lucky1.263xmail.com (Postfix) with SMTP id 18924413; Wed, 22 Jun 2016 10:20:03 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 80C194009; Wed, 22 Jun 2016 10:19:59 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: bhelgaas@google.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <0ae2b768895ceb5843f8a08c58ae6a85> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 30406WKCTEA; Wed, 22 Jun 2016 10:19:59 +0800 (CST) From: Shawn Lin To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Lin Subject: [PATCH] PCI/MSI: Simplify the return value of arch_setup_msi_irqs Date: Wed, 22 Jun 2016 10:18:35 +0800 Message-Id: <1466561915-25929-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/pci/msi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index a080f44..4a40b72 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); @@ -119,13 +119,10 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) if (type == PCI_CAP_ID_MSI && nvec > 1) return 1; - for_each_pci_msi_entry(entry, dev) { + 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; - } return 0; }