diff options
author | Thomas Wood <thomas.wood@intel.com> | 2015-03-25 16:42:57 +0000 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2015-03-26 15:50:59 +0000 |
commit | 47f6b1305cc3752f318a555b932e194e1500c1d8 (patch) | |
tree | 18660c1faf9eadd6ef2bcbe9730eb1fa6c5ced7f /tests | |
parent | 0c4dd28d2d3b39216f9d041119ebf34cc44b7df7 (diff) |
igt.cocci: check the return values of various functions
Add rules to fix unused-result warnings when compiling with
_FORTIFY_SOURCE defined and apply them to the library and tests.
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/kms_fbc_crc.c | 4 | ||||
-rw-r--r-- | tests/kms_vblank.c | 2 | ||||
-rw-r--r-- | tests/pm_lpsp.c | 4 | ||||
-rw-r--r-- | tests/prime_udl.c | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index 4256fede..10e1ca43 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -198,7 +198,7 @@ static bool fbc_enabled(data_t *data) status = igt_debugfs_fopen("i915_fbc_status", "r"); igt_assert(status); - fread(str, sizeof(str) - 1, 1, status); + igt_assert_eq(fread(str, sizeof(str) - 1, 1, status), 1); fclose(status); return strstr(str, "FBC enabled") != NULL; } @@ -510,7 +510,7 @@ igt_main status = igt_debugfs_fopen("i915_fbc_status", "r"); igt_require_f(status, "No i915_fbc_status found\n"); - fread(buf, sizeof(buf), 1, status); + igt_assert_eq(fread(buf, sizeof(buf), 1, status), sizeof(buf)); fclose(status); buf[sizeof(buf) - 1] = '\0'; igt_require_f(!strstr(buf, "unsupported by this chipset") && diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c index 569390e9..5a00cccf 100644 --- a/tests/kms_vblank.c +++ b/tests/kms_vblank.c @@ -101,7 +101,7 @@ static void query(int fd, bool busy) busy ? "busy" : "idle", elapsed(&start, &end, count)); if (busy) - read(fd, buf, sizeof(buf)); + igt_assert_eq(read(fd, buf, sizeof(buf)), sizeof(buf)); } igt_main diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c index 50b3dd9c..3ed4c788 100644 --- a/tests/pm_lpsp.c +++ b/tests/pm_lpsp.c @@ -45,12 +45,12 @@ static void disable_audio_runtime_pm(void) fd = open("/sys/module/snd_hda_intel/parameters/power_save", O_WRONLY); if (fd >= 0) { - write(fd, "1\n", 2); + igt_assert_eq(write(fd, "1\n", 2), 2); close(fd); } fd = open("/sys/bus/pci/devices/0000:00:03.0/power/control", O_WRONLY); if (fd >= 0) { - write(fd, "auto\n", 5); + igt_assert_eq(write(fd, "auto\n", 5), 5); close(fd); } /* Give some time for it to react. */ diff --git a/tests/prime_udl.c b/tests/prime_udl.c index 62b381a3..d03aee06 100644 --- a/tests/prime_udl.c +++ b/tests/prime_udl.c @@ -61,7 +61,7 @@ static int find_and_open_devices(void) if (!fl) break; - fgets(vendor_id, 8, fl); + igt_assert_neq(fgets(vendor_id, 8, fl), NULL); fclose(fl); venid = strtoul(vendor_id, NULL, 16); |