verbs: Document errno behavior of MR fork/attr helpers

Add doc comments recording the errno contract of the internal helpers
on the memory-registration path, so callers relying on errno after a
NULL return can see where it comes from:

- ibv_dontfork_range() / ibv_dofork_range() (driver.h) and the
  underlying ibv_madvise_range(): a non-zero/-1 return sets errno to
  ENOMEM on tracking-node allocation failure, otherwise to the errno
  set by madvise(2).
- fill_mr_init_attr_from_buf(): a -1 return sets errno to EINVAL.

Signed-off-by: Christian Häggström <christian.haggstrom@sambanovasystems.com>
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 1f4ca37..b3cd883 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -784,6 +784,10 @@
 			  uint32_t ncounters,
 			  uint32_t flags,
 			  struct ibv_command_buffer *link);
+/*
+ * Adjust fork protection for the given range. Return 0 on success, or a
+ * non-zero value on failure with errno set to indicate the reason.
+ */
 int ibv_dontfork_range(void *base, size_t size);
 int ibv_dofork_range(void *base, size_t size);
 int ibv_cmd_alloc_dm(struct ibv_context *ctx,
diff --git a/libibverbs/memory.c b/libibverbs/memory.c
index c9821e6..a741955 100644
--- a/libibverbs/memory.c
+++ b/libibverbs/memory.c
@@ -621,6 +621,7 @@
 	return 0;
 }
 
+/* Return 0 on success, or -1 on failure with errno set to indicate the reason. */
 static int ibv_madvise_range(void *base, size_t size, int advice)
 {
 	uintptr_t start, end;
diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c
index d91eb42..d694ad4 100644
--- a/libibverbs/verbs.c
+++ b/libibverbs/verbs.c
@@ -476,6 +476,7 @@
  * The IBV_REG_MR_MASK_BUF bit is consumed here and replaced by the masks the
  * lower layers understand.
  */
+/* Return 0 on success, or -1 on an invalid attr combination with errno set to EINVAL. */
 static int fill_mr_init_attr_from_buf(struct ibv_pd *pd,
 				      struct ibv_mr_init_attr *mr_init_attr)
 {