From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@intel.com
Subject: [PATCH 1/2] drm/i915/gvt: Remove unnecessary check in reg_is_mmio
Date: Tue, 16 Sep 2025 17:43:19 +0000 [thread overview]
Message-ID: <20250916174317.76521-5-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20250916174317.76521-4-jonathan.cavitt@intel.com>
The reg >= 0 check in reg_is_mmio is unnecessary because reg is always
greater than zero in all current use cases. This is obvious when
checking 'offset' by itself (as offset is defined as an unsigned
integer), but it's also true for the offset + bytes - 1 use case in
intel_vgpu_emulate_mmio_read because bytes > 0.
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
drivers/gpu/drm/i915/gvt/mmio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/mmio.c b/drivers/gpu/drm/i915/gvt/mmio.c
index da1135fa7cda..c60d1e548800 100644
--- a/drivers/gpu/drm/i915/gvt/mmio.c
+++ b/drivers/gpu/drm/i915/gvt/mmio.c
@@ -58,7 +58,7 @@ int intel_vgpu_gpa_to_mmio_offset(struct intel_vgpu *vgpu, u64 gpa)
}
#define reg_is_mmio(gvt, reg) \
- (reg >= 0 && reg < gvt->device_info.mmio_size)
+ (reg < gvt->device_info.mmio_size)
#define reg_is_gtt(gvt, reg) \
(reg >= gvt->device_info.gtt_start_offset \
--
2.43.0
next prev parent reply other threads:[~2025-09-16 17:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 17:43 [PATCH 0/2] drm/i915/gvt: Various mmio.c fixes Jonathan Cavitt
2025-09-16 17:43 ` Jonathan Cavitt [this message]
2025-09-17 8:59 ` [PATCH 1/2] drm/i915/gvt: Remove unnecessary check in reg_is_mmio Andi Shyti
2025-09-16 17:43 ` [PATCH 2/2] drm/i915/gvt: Fix intel_vgpu_gpa_to_mmio_offset kernel docs Jonathan Cavitt
2025-09-17 9:00 ` Andi Shyti
2025-09-16 18:54 ` ✓ i915.CI.BAT: success for drm/i915/gvt: Various mmio.c fixes Patchwork
2025-09-16 23:30 ` ✗ i915.CI.Full: failure " Patchwork
2025-09-17 4:39 ` [PATCH 0/2] " Zhenyu Wang
2025-09-17 16:04 ` ✓ i915.CI.BAT: success for drm/i915/gvt: Various mmio.c fixes (rev2) Patchwork
2025-09-17 19:04 ` ✓ i915.CI.Full: " Patchwork
2025-09-18 11:17 ` [PATCH 0/2] drm/i915/gvt: Various mmio.c fixes Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250916174317.76521-5-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=saurabhg.gupta@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox