diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-03-23 12:31:52 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-03-23 12:31:52 +0000 |
commit | d81d857f4421d205395d55200425daa6591c28a5 (patch) | |
tree | 0b383c84ed4a679572bdf7b110809eb97adeca3e /backends | |
parent | e6ebebc204bfb467fba008d6ead5a228508b65ac (diff) | |
parent | 21f88d021d0d2b4ecee8f6cd6ca63a943a3ce71d (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-03-22-v3' into staging
QAPI patches for 2017-03-22
# gpg: Signature made Wed 22 Mar 2017 18:25:15 GMT
# gpg: using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2017-03-22-v3:
qapi: Fix QemuOpts visitor regression on unvisited input
qom: Avoid unvisited 'id'/'qom-type' in user_creatable_add_opts
tests: Expose regression in QemuOpts visitor
test-qobject-input-visitor: Cover visit_type_uint64()
Revert "hostmem: fix QEMU crash by 'info memdev'"
qapi: Fix string input visitor regression for empty lists
qapi2texi: Fix translation of *strong* and _emphasized_
tests/qapi-schema: Systematic positive doc comment tests
tests/qapi-schema: Make test-qapi.py print docs again
qapi: Drop unused QAPIDoc member optional
qapi2texi: Fix to actually fail when 'doc-required' is false
qapi: Drop excessive Make dependencies on qapi2texi.py
MAINTAINERS: Add myself for files I touched recently
keyval: Document issues with 'any' and alternate types
test-keyval: Cover alternate and 'any' type
keyval: Improve some comments
test-keyval: Tweaks to improve list coverage
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/hostmem.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/backends/hostmem.c b/backends/hostmem.c index 162c2187d8..89feb9ed75 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -64,14 +64,6 @@ out: error_propagate(errp, local_err); } -static uint16List **host_memory_append_node(uint16List **node, - unsigned long value) -{ - *node = g_malloc0(sizeof(**node)); - (*node)->value = value; - return &(*node)->next; -} - static void host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -82,23 +74,25 @@ host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name, unsigned long value; value = find_first_bit(backend->host_nodes, MAX_NODES); - - node = host_memory_append_node(node, value); - if (value == MAX_NODES) { - goto out; + return; } + *node = g_malloc0(sizeof(**node)); + (*node)->value = value; + node = &(*node)->next; + do { value = find_next_bit(backend->host_nodes, MAX_NODES, value + 1); if (value == MAX_NODES) { break; } - node = host_memory_append_node(node, value); + *node = g_malloc0(sizeof(**node)); + (*node)->value = value; + node = &(*node)->next; } while (true); -out: visit_type_uint16List(v, name, &host_nodes, errp); } |