Mesa (master): st/egl/drm: only unref the udev device if needed
Alex Deucher
agd5f at kemper.freedesktop.org
Tue Dec 11 17:54:17 UTC 2012
Module: Mesa
Branch: master
Commit: cb8300f5a98016ccc8d34f1bbfee9eb319a2a8a8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb8300f5a98016ccc8d34f1bbfee9eb319a2a8a8
Author: Tobias Droste <tdroste at gmx.de>
Date: Thu Nov 29 17:02:28 2012 +0100
st/egl/drm: only unref the udev device if needed
Fixes compiler warning:
drm/native_drm.c: In function ‘native_create_display’:
drm/native_drm.c:180:21: warning: ‘device’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drm/native_drm.c:157:24: note: ‘device’ was declared here
Signed-off-by: Tobias Droste <tdroste at gmx.de>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
src/gallium/state_trackers/egl/drm/native_drm.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index 23fc137..f0c0f54 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -161,23 +161,24 @@ drm_get_device_name(int fd)
udev = udev_new();
if (fstat(fd, &buf) < 0) {
_eglLog(_EGL_WARNING, "failed to stat fd %d", fd);
- goto out;
+ goto outudev;
}
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
if (device == NULL) {
_eglLog(_EGL_WARNING,
"could not create udev device for fd %d", fd);
- goto out;
+ goto outdevice;
}
tmp = udev_device_get_devnode(device);
if (!tmp)
- goto out;
+ goto outdevice;
device_name = strdup(tmp);
-out:
+outdevice:
udev_device_unref(device);
+outudev:
udev_unref(udev);
#endif
More information about the mesa-commit
mailing list