[PATCH][V2] drm/i915/guc: fix GEM_BUG_ON check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

The check for level being less than zero always false because flags
is currently unsigned and can never be negative. Fix this by making
flags a s32.

Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0")

Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

---
V2: Make flags s32 rather than remove the GEM_BUG_ON check, thanks to
Ville Syrjälä for spotting the mistake in my first attempt.
---
 drivers/gpu/drm/i915/intel_guc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index 116f4ccf1bbd..fb31f5004bcf 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -206,7 +206,7 @@ void intel_guc_fini(struct intel_guc *guc)
 static u32 get_log_control_flags(void)
 {
 	u32 level = i915_modparams.guc_log_level;
-	u32 flags = 0;
+	s32 flags = 0;
 
 	GEM_BUG_ON(level < 0);
 
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux