From: Bartosz Golaszewski Date: Thu, 13 Apr 2023 14:49:58 +0000 (+0200) Subject: tests: check the return value of gpiod_line_config_add_line_settings() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=010207cd0e586ddea4d805deeffb3df4b578eebe;p=qemu-gpiodev%2Flibgpiod.git tests: check the return value of gpiod_line_config_add_line_settings() The call to gpiod_line_config_add_line_settings() can fail in the thread function used by info-event test cases so check its return value and act accordingly. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/tests-info-event.c b/tests/tests-info-event.c index 9f942eb..d069811 100644 --- a/tests/tests-info-event.c +++ b/tests/tests-info-event.c @@ -79,8 +79,11 @@ static gpointer request_reconfigure_release_line(gpointer data) gpiod_line_config_reset(ctx->line_cfg); gpiod_line_settings_set_direction(ctx->settings, GPIOD_LINE_DIRECTION_OUTPUT); - gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset, 1, - ctx->settings); + ret = gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset, + 1, ctx->settings); + g_assert_cmpint(ret, ==, 0); + if (g_test_failed()) + return NULL; ret = gpiod_line_request_reconfigure_lines(request, ctx->line_cfg); g_assert_cmpint(ret, ==, 0);