From patchwork Wed Jun 22 03:20:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9191837 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 E3EEA6075C for ; Wed, 22 Jun 2016 03:34:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD33A200DF for ; Wed, 22 Jun 2016 03:34:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C20BB283E6; Wed, 22 Jun 2016 03:34:33 +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 C0942200DF for ; Wed, 22 Jun 2016 03:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751381AbcFVDeQ (ORCPT ); Tue, 21 Jun 2016 23:34:16 -0400 Received: from lucky1.263xmail.com ([211.157.147.132]:43089 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbcFVDeP (ORCPT ); Tue, 21 Jun 2016 23:34:15 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.172]) by lucky1.263xmail.com (Postfix) with SMTP id DA2FF63636; Wed, 22 Jun 2016 11:21:41 +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 265682E35; Wed, 22 Jun 2016 11:21:39 +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: 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 14739EM8XHI; Wed, 22 Jun 2016 11:21:39 +0800 (CST) From: Shawn Lin To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Lin Subject: [PATCH v2] PCI/MSI: Simplify the return value of arch_setup_msi_irqs Date: Wed, 22 Jun 2016 11:20:20 +0800 Message-Id: <1466565620-27183-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 --- 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; }