commit adbcbf1
Michael Forney
·
2013-09-13 00:08:56 +0000 UTC
parent 13e0a59
drm: initialize: Fix error handling
1 files changed,
+10,
-10
+10,
-10
1@@ -292,7 +292,7 @@ bool swc_drm_initialize(struct swc_drm * drm, struct udev * udev,
2 if (!drm_device)
3 {
4 printf("couldn't find drm device\n");
5- goto error_base;
6+ goto error0;
7 }
8
9 /* XXX: Why do we need the sysnum? */
10@@ -304,35 +304,35 @@ bool swc_drm_initialize(struct swc_drm * drm, struct udev * udev,
11 if (*end != '\0')
12 {
13 printf("couldn't get drm device sysnum\n");
14- goto error_device;
15+ udev_device_unref(drm_device);
16+ goto error0;
17 }
18
19 printf("sysnum: %s\n", sysnum);
20
21 drm->path = strdup(udev_device_get_devnode(drm_device));
22+ udev_device_unref(drm_device);
23 drm->fd = open(drm->path, O_RDWR | O_CLOEXEC);
24
25 if (drm->fd == -1)
26 {
27 printf("couldn't open %s\n", device_path);
28- goto error_device;
29+ goto error1;
30 }
31
32 if (!(drm->context = wld_drm_create_context(drm->fd)))
33 {
34 fprintf(stderr, "Could not create WLD DRM context\n");
35- goto error_fd;
36+ goto error2;
37 }
38
39- udev_device_unref(drm_device);
40-
41 return true;
42
43- error_fd:
44+ error2:
45 close(drm->fd);
46- error_device:
47- udev_device_unref(drm_device);
48- error_base:
49+ error1:
50+ free(drm->path);
51+ error0:
52 return false;
53 }
54