pad: don't print a clobbered errno

is_litest_device() may change errno since it calls into libudev.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>
This commit is contained in:
Peter Hutterer 2024-10-22 12:15:04 +10:00 committed by Marge Bot
parent 54f3733b76
commit 0c782c4084

View file

@ -213,15 +213,15 @@ pad_group_new(struct pad_dispatch *pad,
struct pad_mode_led *led;
led = pad_led_new(libinput, syspath, group_index, nleds);
if (!led)
if (!led) {
rc = -errno;
goto error;
}
list_insert(&group->led_list, &led->link);
}
rc = pad_led_group_get_mode(group);
if (rc < 0) {
errno = -rc;
goto error;
}
@ -233,7 +233,7 @@ error:
if (!is_litest_device(pad->device))
evdev_log_error(pad->device,
"unable to init LED group: %s\n",
strerror(errno));
strerror(-rc));
pad_led_group_destroy(&group->base);
return NULL;