Skip to contentSkip to conversation

Fix one warning (v2)

PATCH In review Jammy Zhou 3 participants 3 messages Apr 27, 2015 – Apr 28, 2015

lore
Share & tools
lore

Jammy Zhou

author
#0 lore raw

PATCH 2/2 Fix one warning (v2)

xf86drm.c:356:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
^

v2: do 'int' cast to fix the warning

---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drm.c +1 -1
index 4d67861..4ecb24f 100644
@@ -353,7 +353,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     }
 
     if (drm_server_info) {
-	group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
+	group = ((int)serv_group >= 0) ? serv_group : DRM_DEV_GID;
 	chown_check_return(buf, user, group);
 	chmod(buf, devmode);
     }
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#1 lore raw
Quoted 7 lines · Jammy Zhou

xf86drm.c:356:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
^

v2: do 'int' cast to fix the warning

FWIW

Emil, are you OK with this approach?

Quoted 17 lines
---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drm.c +1 -1
index 4d67861..4ecb24f 100644
@@ -353,7 +353,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     }
 
     if (drm_server_info) {
-	group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
+	group = ((int)serv_group >= 0) ? serv_group : DRM_DEV_GID;
 	chown_check_return(buf, user, group);
 	chmod(buf, devmode);
     }
Signature · 1 line
Jan Vesely <[email protected]>

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 5 lines · Jan Vesely
Quoted 4 lines · Jammy Zhou

xf86drm.c:356:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
^

Quoted 9 lines
Quoted 3 lines

v2: do 'int' cast to fix the warning

FWIW

Emil, are you OK with this approach?

Ideally one of the old school devs will chip in, but this looks good imho. Lets give it a week or so for other interested parties to chip-in.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel