mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: roel kluin <roel.kluin@gmail.com>
To: galak@kernel.crashing.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [POWERPC] unsigned hwirq cannot be negative
Date: Tue, 09 Sep 2008 22:34:17 +0200	[thread overview]
Message-ID: <48C6DDC9.4060309@gmail.com> (raw)

This patch is not tested
---
fsl_msi_alloc_hwirqs() converts an int from bitmap_find_free_region()
into an irq_hw_number_t, but this can be an -ENOMEM. This is tested
in fsl_setup_msi_irqs(), but incorrectly: irq_hw_number_t is
unsigned.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 2c5187c..a2aa59a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -67,7 +67,7 @@ static struct irq_host_ops fsl_msi_host_ops = {
 	.map = fsl_msi_host_map,
 };
 
-static irq_hw_number_t fsl_msi_alloc_hwirqs(struct fsl_msi *msi, int num)
+static int fsl_msi_alloc_hwirqs(struct fsl_msi *msi, int num)
 {
 	unsigned long flags;
 	int order = get_count_order(num);
@@ -205,13 +205,13 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	struct fsl_msi *msi_data = fsl_msi;
 
 	list_for_each_entry(entry, &pdev->msi_list, list) {
-		hwirq = fsl_msi_alloc_hwirqs(msi_data, 1);
-		if (hwirq < 0) {
-			rc = hwirq;
+		rc = fsl_msi_alloc_hwirqs(msi_data, 1);
+		if (rc < 0) {
 			pr_debug("%s: fail allocating msi interrupt\n",
 					__func__);
 			goto out_free;
 		}
+		hwirq = rc;
 
 		virq = irq_create_mapping(msi_data->irqhost, hwirq);
 

                 reply	other threads:[~2008-09-09 20:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48C6DDC9.4060309@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=galak@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome