spapr/xive: Fix xive->fd if kvm_create_device() fails
commit82f086b5e7ec0adff5a3972f74c446325b4fef9a
authorGreg Kurz <groug@kaod.org>
Thu, 6 Aug 2020 16:56:05 +0000 (6 18:56 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 12 Aug 2020 03:16:27 +0000 (12 13:16 +1000)
tree765b208e434fcd3cf6c2e8eb27e360759b7e6e6b
parentc55bcb1f47071a134a4b96b4137cccca831ac5cf
spapr/xive: Fix xive->fd if kvm_create_device() fails

If the creation of the KVM XIVE device fails for some reasons, the
negative errno ends up in xive->fd, but the rest of the code assumes
that xive->fd either contains an open fd, ie. positive value, or -1.

This doesn't cause any misbehavior except kvmppc_xive_disconnect()
that will try to close(xive->fd) during rollback and likely be
rewarded with an EBADF.

Only set xive->fd with a open fd.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <159673296585.766512.15404407281299745442.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/intc/spapr_xive_kvm.c