]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/ipath/ipath_mr.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / ipath / ipath_mr.c
index 69ffec66d45da972b01f0118d4ecbec13209831a..b36f6fb3e37a76f16ae370aa1e6ee163227b7df6 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2006 QLogic, Inc. All rights reserved.
  * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
 
 #include "ipath_verbs.h"
 
+/* Fast memory region */
+struct ipath_fmr {
+       struct ib_fmr ibfmr;
+       u8 page_shift;
+       struct ipath_mregion mr;        /* must be last */
+};
+
+static inline struct ipath_fmr *to_ifmr(struct ib_fmr *ibfmr)
+{
+       return container_of(ibfmr, struct ipath_fmr, ibfmr);
+}
+
 /**
  * ipath_get_dma_mr - get a DMA memory region
  * @pd: protection domain for this memory region
@@ -169,6 +182,11 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
        int n, m, i;
        struct ib_mr *ret;
 
+       if (region->length == 0) {
+               ret = ERR_PTR(-EINVAL);
+               goto bail;
+       }
+
        n = 0;
        list_for_each_entry(chunk, &region->chunk_list, list)
                n += chunk->nents;