]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/gvt: Remove unnecessary check in reg_is_mmio
authorJonathan Cavitt <jonathan.cavitt@intel.com>
Tue, 16 Sep 2025 17:43:19 +0000 (17:43 +0000)
committerAndi Shyti <andi.shyti@linux.intel.com>
Thu, 18 Sep 2025 11:07:05 +0000 (13:07 +0200)
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>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw.linux@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250916174317.76521-5-jonathan.cavitt@intel.com
drivers/gpu/drm/i915/gvt/mmio.c

index da1135fa7cda48e9ec89fdc318131d39f6e1332e..c60d1e5488001afc07f631c3b839faebd4479b29 100644 (file)
@@ -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 \