static int session_device_verify(SessionDevice *sd) {
_cleanup_(sd_device_unrefp) sd_device *p = NULL;
+ const char *sp, *node;
sd_device *dev;
- const char *sp = NULL, *node;
int r;
- if (sd_device_new_from_devnum(&p, 'c', sd->dev) < 0)
- return -ENODEV;
+ r = sd_device_new_from_devnum(&p, 'c', sd->dev);
+ if (r < 0)
+ return r;
dev = p;
- (void) sd_device_get_syspath(dev, &sp);
- if (sd_device_get_devname(dev, &node) < 0)
+ if (sd_device_get_syspath(dev, &sp) < 0 ||
+ sd_device_get_devname(dev, &node) < 0)
return -EINVAL;
/* detect device type so we can find the correct sysfs parent */
max_width = n_columns;
while (*i_dev < n_dev) {
- const char *sysfs, *sn, *name = NULL, *subsystem = NULL, *sysname = NULL;
+ const char *sysfs, *sn, *name = NULL, *subsystem, *sysname;
_cleanup_free_ char *k = NULL, *l = NULL;
size_t lookahead;
bool is_master;
sn = "seat0";
/* Explicitly also check for tag 'seat' here */
- if (!streq(seat, sn) || sd_device_has_tag(dev_list[*i_dev], "seat") <= 0) {
+ if (!streq(seat, sn) ||
+ sd_device_has_tag(dev_list[*i_dev], "seat") <= 0 ||
+ sd_device_get_subsystem(dev_list[*i_dev], &subsystem) < 0 ||
+ sd_device_get_sysname(dev_list[*i_dev], &sysname) < 0) {
(*i_dev)++;
continue;
}
if (sd_device_get_sysattr_value(dev_list[*i_dev], "name", &name) < 0)
(void) sd_device_get_sysattr_value(dev_list[*i_dev], "id", &name);
- (void) sd_device_get_subsystem(dev_list[*i_dev], &subsystem);
- (void) sd_device_get_sysname(dev_list[*i_dev], &sysname);
-
/* Look if there's more coming after this */
for (lookahead = *i_dev + 1; lookahead < n_dev; lookahead++) {
const char *lookahead_sysfs;