[Mesa-dev] [PATCH] st/egl/drm: only unref the udev device if needed

Alex Deucher alexdeucher at gmail.com
Wed Dec 5 06:31:48 PST 2012


On Tue, Dec 4, 2012 at 12:50 PM, Tobias Droste <tdroste at gmx.de> wrote:
> Anyone interested? ;-)
>
> I would just push it, but I don't have the rights to do so.

Looks reasonable to me.

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

>
> Am Do, 29. November 2012, 17:02:28 schrieben Sie:
>> 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>
>> ---
>>  src/gallium/state_trackers/egl/drm/native_drm.c |    9 +++++----
>>  1 Datei geändert, 5 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
>>
>> 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
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list