Remove config_odev_add_*attribute checks in various places

Note that there are more callers but those were already not doing any
error checking.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Hans de Goede 2014-03-11 11:38:09 +01:00
parent 92ff79f1a8
commit 40e3c79a59
2 changed files with 7 additions and 30 deletions

View File

@ -55,7 +55,7 @@
static struct udev_monitor *udev_monitor; static struct udev_monitor *udev_monitor;
#ifdef CONFIG_UDEV_KMS #ifdef CONFIG_UDEV_KMS
static Bool static void
config_udev_odev_setup_attribs(const char *path, const char *syspath, config_udev_odev_setup_attribs(const char *path, const char *syspath,
int major, int minor, int major, int minor,
config_odev_probe_proc_ptr probe_callback); config_odev_probe_proc_ptr probe_callback);
@ -457,40 +457,20 @@ config_udev_fini(void)
#ifdef CONFIG_UDEV_KMS #ifdef CONFIG_UDEV_KMS
static Bool static void
config_udev_odev_setup_attribs(const char *path, const char *syspath, config_udev_odev_setup_attribs(const char *path, const char *syspath,
int major, int minor, int major, int minor,
config_odev_probe_proc_ptr probe_callback) config_odev_probe_proc_ptr probe_callback)
{ {
struct OdevAttributes *attribs = config_odev_allocate_attribute_list(); struct OdevAttributes *attribs = config_odev_allocate_attribute_list();
int ret;
if (!attribs) config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path);
return FALSE; config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MAJOR, major);
ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path); config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MINOR, minor);
if (ret == FALSE)
goto fail;
ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
if (ret == FALSE)
goto fail;
ret = config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MAJOR, major);
if (ret == FALSE)
goto fail;
ret = config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MINOR, minor);
if (ret == FALSE)
goto fail;
/* ownership of attribs is passed to probe layer */ /* ownership of attribs is passed to probe layer */
probe_callback(attribs); probe_callback(attribs);
return TRUE;
fail:
config_odev_free_attributes(attribs);
free(attribs);
return FALSE;
} }
void void

View File

@ -40,10 +40,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
systemd_logind_release_fd(major, minor); systemd_logind_release_fd(major, minor);
return FALSE; return FALSE;
} }
if (!config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd)) { config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd);
systemd_logind_release_fd(major, minor);
return FALSE;
}
server_fd = TRUE; server_fd = TRUE;
} }