diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-02-19 21:39:03 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-02-19 21:39:03 +0100 |
commit | 8e3ca35d122a4f8a2636b8bb07fec93443895a4d (patch) | |
tree | 9bf0d01bbd7b33ee2050313e5857674da6b37761 | |
parent | 96534002eff8d3cc9c823886fdff1487ccbafc92 (diff) | |
download | libgpiod-8e3ca35d122a4f8a2636b8bb07fec93443895a4d.tar.gz |
tests: fix a potential assert() abort()
If info is NULL in one of the line-info test cases, we'll still try to
read its property leading to an abort() triggered from assert(info). Just
bail out of the test function if gpiod_chip_get_line_info() fails.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r-- | tests/tests-line-info.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/tests-line-info.c b/tests/tests-line-info.c index 137084ec..75b38f03 100644 --- a/tests/tests-line-info.c +++ b/tests/tests-line-info.c @@ -19,8 +19,7 @@ GPIOD_TEST_CASE(get_line_info_good) chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim)); - info = gpiod_chip_get_line_info(chip, 3); - g_assert_nonnull(info); + info = gpiod_test_get_line_info_or_fail(chip, 3); g_assert_cmpuint(gpiod_line_info_get_offset(info), ==, 3); } |