IB/qib: fix test of unsigned variable
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 12 May 2015 17:42:42 +0000 (13:42 -0400)
committerDoug Ledford <dledford@redhat.com>
Tue, 12 May 2015 17:55:41 +0000 (13:55 -0400)
Commit d4988623cc60 ("IB/qib: use arch_phys_wc_add()")
adjusted mtrr inititialization to use the new interface.

Unfortunately, the new interface returns a signed
value and the patch tested the unsigned wc_cookie.

Fix the issue by changing the type of wc_cookie to int.  For
the success case the ret left at zero to avoid
a warning from the caller.  For failure wc_cookie
is used as the ret.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/qib/qib.h
drivers/infiniband/hw/qib/qib_wc_x86_64.c

index ba5173e249738cb123560a29701bdacb496e9fc8..7df16f74bb4585e971e1208dd348911d142f78fb 100644 (file)
@@ -903,7 +903,7 @@ struct qib_devdata {
        /* PCI Device ID (here for NodeInfo) */
        u16 deviceid;
        /* for write combining settings */
-       unsigned long wc_cookie;
+       int wc_cookie;
        unsigned long wc_base;
        unsigned long wc_len;
 
index 6d61ef98721cb02f6b4baeead132cbe1d399753c..edd0ddbd44815d8e48ed49d3dec46e37545aa031 100644 (file)
@@ -118,7 +118,8 @@ int qib_enable_wc(struct qib_devdata *dd)
        if (!ret) {
                dd->wc_cookie = arch_phys_wc_add(pioaddr, piolen);
                if (dd->wc_cookie < 0)
-                       ret = -EINVAL;
+                       /* use error from routine */
+                       ret = dd->wc_cookie;
        }
 
        return ret;