Commit 182b9203 authored by Amit Shah's avatar Amit Shah Committed by Anthony Liguori

balloon: Simplify code flow

Replace:
  if (foo) {
    ...
  } else {
    return 0;
  }

by

  if (!foo) {
    return 0;
  }
  ...
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent b80bc1dd
......@@ -42,23 +42,21 @@ void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque)
static int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque)
{
if (balloon_event_fn) {
trace_balloon_event(balloon_opaque, target);
balloon_event_fn(balloon_opaque, target, cb, opaque);
return 1;
} else {
if (!balloon_event_fn) {
return 0;
}
trace_balloon_event(balloon_opaque, target);
balloon_event_fn(balloon_opaque, target, cb, opaque);
return 1;
}
static int qemu_balloon_status(MonitorCompletion cb, void *opaque)
{
if (balloon_event_fn) {
balloon_event_fn(balloon_opaque, 0, cb, opaque);
return 1;
} else {
if (!balloon_event_fn) {
return 0;
}
balloon_event_fn(balloon_opaque, 0, cb, opaque);
return 1;
}
static void print_balloon_stat(const char *key, QObject *obj, void *opaque)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment