summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2014-09-24 09:06:47 -0400
committerChris Michael <cp.michael@samsung.com>2014-09-24 09:06:47 -0400
commite3c3ba481127bcf03582794639f5b44dedece289 (patch)
tree1ad3b7325f39bb867da5ef4e8f39519beb5cac6a
parent15d9fec0e00cc4b2a632f43711f629c8f9683da3 (diff)
ecore-drm: Remove need to use an extra variable for storing device.
Summary: This commit just modifies the internal code to remove the need for an extra variable. There really is no need to store the device twice. We already have it in the list of returned devices. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 4b7c4e3017..2f7495d78d 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -153,7 +153,7 @@ ecore_drm_device_find(const char *name, const char *seat)
153 Ecore_Drm_Device *dev = NULL; 153 Ecore_Drm_Device *dev = NULL;
154 Eina_Bool found = EINA_FALSE; 154 Eina_Bool found = EINA_FALSE;
155 Eina_List *devs, *l; 155 Eina_List *devs, *l;
156 const char *device, *tmpdevice; 156 const char *device;
157 157
158 /* try to get a list of drm devics */ 158 /* try to get a list of drm devics */
159 if (!(devs = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRM, name))) 159 if (!(devs = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRM, name)))
@@ -200,26 +200,19 @@ ecore_drm_device_find(const char *name, const char *seat)
200 200
201cont: 201cont:
202 eina_stringshare_del(devpath); 202 eina_stringshare_del(devpath);
203 if (found) 203 if (found) break;
204 {
205 tmpdevice = eina_stringshare_add(device);
206 break;
207 }
208 } 204 }
209 205
210 EINA_LIST_FREE(devs, device) 206 if (!found) goto out;
211 eina_stringshare_del(device);
212
213 if (!found) return NULL;
214 207
215 if ((dev = calloc(1, sizeof(Ecore_Drm_Device)))) 208 if ((dev = calloc(1, sizeof(Ecore_Drm_Device))))
216 { 209 {
217 dev->drm.name = eeze_udev_syspath_get_devpath(tmpdevice); 210 dev->drm.name = eeze_udev_syspath_get_devpath(device);
218 dev->drm.path = eina_stringshare_add(tmpdevice); 211 dev->drm.path = eina_stringshare_add(device);
219 212
220 dev->id = eeze_udev_syspath_get_sysnum(tmpdevice); 213 dev->id = eeze_udev_syspath_get_sysnum(device);
221 214
222 dev->seat = eeze_udev_syspath_get_property(tmpdevice, "ID_SEAT"); 215 dev->seat = eeze_udev_syspath_get_property(device, "ID_SEAT");
223 if (!dev->seat) dev->seat = eina_stringshare_add("seat0"); 216 if (!dev->seat) dev->seat = eina_stringshare_add("seat0");
224 217
225 dev->format = 0; 218 dev->format = 0;
@@ -228,7 +221,9 @@ cont:
228 DBG("Using Drm Device: %s", dev->drm.name); 221 DBG("Using Drm Device: %s", dev->drm.name);
229 } 222 }
230 223
231 eina_stringshare_del(tmpdevice); 224out:
225 EINA_LIST_FREE(devs, device)
226 eina_stringshare_del(device);
232 227
233 return dev; 228 return dev;
234} 229}