diff mbox

[libdrm,7/8] Fix unused, and unused-but-set variables warnings

Message ID 1425060448-5315-8-git-send-email-jan.vesely@rutgers.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Vesely Feb. 27, 2015, 6:07 p.m. UTC
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
---
 tests/exynos/exynos_fimg2d_test.c | 4 +---
 xf86drm.c                         | 9 ++++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

Comments

Emil Velikov March 13, 2015, 10:56 p.m. UTC | #1
On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> ---
>  tests/exynos/exynos_fimg2d_test.c | 4 +---
>  xf86drm.c                         | 9 ++++++---
>  2 files changed, 7 insertions(+), 6 deletions(-)
>
...
> @@ -333,7 +336,6 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
>         drm_server_info->get_perms(&serv_group, &serv_mode);
>         devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
>         devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
> -       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
>      }
>
>  #if !defined(UDEV)
> @@ -354,6 +356,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
>      }
>
>      if (drm_server_info) {
> +       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
I think you can leave this back where it was. It doesn't seem to bring
anything beneficial.

-Emil
Jan Vesely March 13, 2015, 11:37 p.m. UTC | #2
On Fri, 2015-03-13 at 22:56 +0000, Emil Velikov wrote:
> On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> > Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> > ---
> >  tests/exynos/exynos_fimg2d_test.c | 4 +---
> >  xf86drm.c                         | 9 ++++++---
> >  2 files changed, 7 insertions(+), 6 deletions(-)
> >
> ...
> > @@ -333,7 +336,6 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
> >         drm_server_info->get_perms(&serv_group, &serv_mode);
> >         devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
> >         devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
> > -       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
> >      }
> >
> >  #if !defined(UDEV)
> > @@ -354,6 +356,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
> >      }
> >
> >      if (drm_server_info) {
> > +       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
> I think you can leave this back where it was. It doesn't seem to bring
> anything beneficial.

"group" variable is now only available #if !defined(UDEV), so  I can;'t
really move it back without adding a pair of ifdefs,
moving it here looked nicer than adding another set of #if/#endif.

I wanted to move the declaration here as well, but I'm not sure how it'd
play with old/broken compilers that need to be supported.

jan

> 
> -Emil
Emil Velikov March 14, 2015, 1:14 p.m. UTC | #3
On 13/03/15 23:37, Jan Vesely wrote:
> On Fri, 2015-03-13 at 22:56 +0000, Emil Velikov wrote:
>> On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
>>> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
>>> ---
>>>  tests/exynos/exynos_fimg2d_test.c | 4 +---
>>>  xf86drm.c                         | 9 ++++++---
>>>  2 files changed, 7 insertions(+), 6 deletions(-)
>>>
>> ...
>>> @@ -333,7 +336,6 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
>>>         drm_server_info->get_perms(&serv_group, &serv_mode);
>>>         devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
>>>         devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
>>> -       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
>>>      }
>>>
>>>  #if !defined(UDEV)
>>> @@ -354,6 +356,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
>>>      }
>>>
>>>      if (drm_server_info) {
>>> +       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
>> I think you can leave this back where it was. It doesn't seem to bring
>> anything beneficial.
> 
> "group" variable is now only available #if !defined(UDEV), so  I can;'t
> really move it back without adding a pair of ifdefs,
> moving it here looked nicer than adding another set of #if/#endif.
> 
> I wanted to move the declaration here as well, but I'm not sure how it'd
> play with old/broken compilers that need to be supported.
> 
Got confused in the #ifdef spaghetti. Comment withdrawn.

Thanks
Emil
diff mbox

Patch

diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index ba8d12c..38ea974 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -322,7 +322,7 @@  static int g2d_copy_with_scale_test(struct exynos_device *dev,
 {
 	struct g2d_context *ctx;
 	struct g2d_image src_img, dst_img;
-	unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
+	unsigned int src_x, src_y, img_w, img_h;
 	unsigned long userptr, size;
 	int ret;
 
@@ -336,8 +336,6 @@  static int g2d_copy_with_scale_test(struct exynos_device *dev,
 
 	src_x = 0;
 	src_y = 0;
-	dst_x = 0;
-	dst_y = 0;
 	img_w = screen_width;
 	img_h = screen_height;
 
diff --git a/xf86drm.c b/xf86drm.c
index 016247f..3c8fc0b 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -308,10 +308,13 @@  static int drmOpenDevice(dev_t dev, int minor, int type)
     char            buf[64];
     int             fd;
     mode_t          devmode = DRM_DEV_MODE, serv_mode;
+    gid_t           serv_group;
+#if !defined(UDEV)
     int             isroot  = !geteuid();
     uid_t           user    = DRM_DEV_UID;
-    gid_t           group   = DRM_DEV_GID, serv_group;
-    
+    gid_t           group   = DRM_DEV_GID;
+#endif
+
     switch (type) {
     case DRM_NODE_PRIMARY:
 	    dev_name = DRM_DEV_NAME;
@@ -333,7 +336,6 @@  static int drmOpenDevice(dev_t dev, int minor, int type)
 	drm_server_info->get_perms(&serv_group, &serv_mode);
 	devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
 	devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
-	group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
     }
 
 #if !defined(UDEV)
@@ -354,6 +356,7 @@  static int drmOpenDevice(dev_t dev, int minor, int type)
     }
 
     if (drm_server_info) {
+	group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
 	chown_check_return(buf, user, group);
 	chmod(buf, devmode);
     }