mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-21 13:23:02 +00:00
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>
This commit is contained in:
+2
-2
@@ -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") &&
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+2
-2
@@ -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. */
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user