* Map @nr_grefs pages of memory into this domain from another
* domain's grant table. xenbus_map_ring_valloc allocates @nr_grefs
* pages of virtual address space, maps the pages to that address, and
- * sets *vaddr to that address. Returns 0 on success, and GNTST_*
- * (see xen/include/interface/grant_table.h) or -ENOMEM / -EINVAL on
+ * sets *vaddr to that address. Returns 0 on success, and -errno on
* error. If an error is returned, device will switch to
* XenbusStateClosing and the error message will be saved in XenStore.
*/
return -ENOMEM;
info->node = kzalloc(sizeof(*info->node), GFP_KERNEL);
- if (!info->node) {
+ if (!info->node)
err = -ENOMEM;
- goto out;
- }
-
- err = ring_ops->map(dev, info, gnt_refs, nr_grefs, vaddr);
-
- /* Some hypervisors are buggy and can return 1. */
- if (err > 0)
- err = GNTST_general_error;
+ else
+ err = ring_ops->map(dev, info, gnt_refs, nr_grefs, vaddr);
- out:
kfree(info->node);
kfree(info);
return err;
bool *leaked)
{
int i, j;
- int err = GNTST_okay;
if (nr_grefs > XENBUS_MAX_RING_GRANTS)
return -EINVAL;
for (i = 0; i < nr_grefs; i++) {
if (info->map[i].status != GNTST_okay) {
- err = info->map[i].status;
xenbus_dev_fatal(dev, info->map[i].status,
"mapping in shared page %d from domain %d",
gnt_refs[i], dev->otherend_id);
handles[i] = info->map[i].handle;
}
- return GNTST_okay;
+ return 0;
fail:
for (i = j = 0; i < nr_grefs; i++) {
}
}
- return err;
+ return -ENOENT;
}
/**