diff mbox series

[for-5.2,2/5] spapr/xive: Simplify kvmppc_xive_disconnect()

Message ID 159664892990.638781.13517846040386267779.stgit@bahia.lan (mailing list archive)
State New, archived
Headers show
Series spapr: Cleanups for XIVE and PHB | expand

Commit Message

Greg Kurz Aug. 5, 2020, 5:35 p.m. UTC
Since this function begins with:

    /* The KVM XIVE device is not in use */
    if (!xive || xive->fd == -1) {
        return;
    }

we obviously don't need to check xive->fd again.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/intc/spapr_xive_kvm.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

David Gibson Aug. 6, 2020, 5:05 a.m. UTC | #1
On Wed, Aug 05, 2020 at 07:35:29PM +0200, Greg Kurz wrote:
> Since this function begins with:
> 
>     /* The KVM XIVE device is not in use */
>     if (!xive || xive->fd == -1) {
>         return;
>     }
> 
> we obviously don't need to check xive->fd again.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-5.2.

> ---
>  hw/intc/spapr_xive_kvm.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
> index d55ea4670e0e..893a1ee77e70 100644
> --- a/hw/intc/spapr_xive_kvm.c
> +++ b/hw/intc/spapr_xive_kvm.c
> @@ -873,10 +873,8 @@ void kvmppc_xive_disconnect(SpaprInterruptController *intc)
>       * and removed from the list of devices of the VM. The VCPU
>       * presenters are also detached from the device.
>       */
> -    if (xive->fd != -1) {
> -        close(xive->fd);
> -        xive->fd = -1;
> -    }
> +    close(xive->fd);
> +    xive->fd = -1;
>  
>      kvm_kernel_irqchip = false;
>      kvm_msi_via_irqfd_allowed = false;
> 
>
diff mbox series

Patch

diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index d55ea4670e0e..893a1ee77e70 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -873,10 +873,8 @@  void kvmppc_xive_disconnect(SpaprInterruptController *intc)
      * and removed from the list of devices of the VM. The VCPU
      * presenters are also detached from the device.
      */
-    if (xive->fd != -1) {
-        close(xive->fd);
-        xive->fd = -1;
-    }
+    close(xive->fd);
+    xive->fd = -1;
 
     kvm_kernel_irqchip = false;
     kvm_msi_via_irqfd_allowed = false;