[PATCH 19/61] kvm: Prefer IS_ERR_OR_NULL over manual NULL check
From: Philipp Hahn
Date: Tue Mar 10 2026 - 09:27:22 EST
Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
check.
Change generated with coccinelle.
To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: kvm@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Philipp Hahn <phahn-oss@xxxxxx>
---
virt/kvm/eventfd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 0e8b8a2c5b791243e230a91124d32fcc0250a0c6..4099dd11626009a3497ad09994ba6bc1b8211536 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -508,10 +508,10 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
if (irqfd->resampler)
irqfd_resampler_shutdown(irqfd);
- if (resamplefd && !IS_ERR(resamplefd))
+ if (!IS_ERR_OR_NULL(resamplefd))
eventfd_ctx_put(resamplefd);
- if (eventfd && !IS_ERR(eventfd))
+ if (!IS_ERR_OR_NULL(eventfd))
eventfd_ctx_put(eventfd);
out:
--
2.43.0