[POWERPC] mpic_pasemi_msi: Failed allocation unnoticed
authorRoel Kluin <12o3l@tiscali.nl>
Wed, 23 Apr 2008 22:32:26 +0000 (08:32 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 14 May 2008 12:31:20 +0000 (22:31 +1000)
bitmap_find_free_region(), called by mpic_msi_alloc_hwirqs() may return
signed, but hwirq is unsigned.  A failed allocation remains unnoticed.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/sysdev/mpic_pasemi_msi.c

index 33cbfb22ce3e3d32abf75fe8241fe05862f418fe..68aff6076675a433fe1144c20eff86e85e4c37c1 100644 (file)
@@ -95,6 +95,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
        unsigned int virq;
        struct msi_desc *entry;
        struct msi_msg msg;
+       int ret;
 
        pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
                 pdev, nvec, type);
@@ -108,8 +109,9 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
                 * few MSIs for someone, but restrictions will apply to how the
                 * sources can be changed independently.
                 */
-               hwirq = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK);
-               if (hwirq < 0) {
+               ret = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK);
+               hwirq = ret;
+               if (ret < 0) {
                        pr_debug("pasemi_msi: failed allocating hwirq\n");
                        return hwirq;
                }