Skip to contentSkip to conversation

kvm/eventfd: remove unneeded conversion to bool

PATCH Applied Jason Yan 3 participants 4 messages Apr 20, 2020 – Apr 25, 2020 KVM

lore
Share & tools
lore

Jason Yan

author
#0 lore raw

PATCH 1/1 kvm/eventfd: remove unneeded conversion to bool

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

virt/kvm/eventfd.c:724:38-43: WARNING: conversion to bool not needed here

---
 virt/kvm/eventfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/eventfd.c +1 -1
index 67b6fc153e9c..0c4ede45e6bd 100644
@@ -721,7 +721,7 @@ ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val)
 		return false;
 	}
 
-	return _val == p->datamatch ? true : false;
+	return _val == p->datamatch;
 }
 
 /* MMIO/PIO writes trigger an event if the addr/val match */
Signature · 1 line
2.21.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jason Yan

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

virt/kvm/eventfd.c:724:38-43: WARNING: conversion to bool not needed here

Signature · 1 line
Peter Xu
maintainer Applied
#2 lore raw
In reply to Jason Yan
Quoted 17 lines · Jason Yan

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

virt/kvm/eventfd.c:724:38-43: WARNING: conversion to bool not needed here

---
 virt/kvm/eventfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/eventfd.c +0 -0
index 67b6fc153e9c..0c4ede45e6bd 100644

virt/kvm/eventfd.c ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val) · line 727

Quoted 8 lines
virt/kvm/eventfd.c +1 -1
@@ -721,7 +721,7 @@ ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val)
 		return false;
 	}
 
-	return _val == p->datamatch ? true : false;
+	return _val == p->datamatch;
 }
 
 /* MMIO/PIO writes trigger an event if the addr/val match */

Queued, thanks.

Paolo

maintainer Applied
#3 lore raw
In reply to Jason Yan
Quoted 17 lines · Jason Yan

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

virt/kvm/eventfd.c:724:38-43: WARNING: conversion to bool not needed here

---
 virt/kvm/eventfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/eventfd.c +0 -0
index 67b6fc153e9c..0c4ede45e6bd 100644

virt/kvm/eventfd.c ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val) · line 727

Quoted 8 lines
virt/kvm/eventfd.c +1 -1
@@ -721,7 +721,7 @@ ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val)
 		return false;
 	}
 
-	return _val == p->datamatch ? true : false;
+	return _val == p->datamatch;
 }
 
 /* MMIO/PIO writes trigger an event if the addr/val match */

Queued, thanks.

Paolo