diff options
author | Lyude Paul <lyude@redhat.com> | 2020-10-09 13:50:57 -0400 |
---|---|---|
committer | Lyude Paul <lyude@redhat.com> | 2020-10-12 18:01:34 -0400 |
commit | d5f40f0191690f686006c5e567eeab07fc6533dd (patch) | |
tree | 8c0dd3dbd7dd86396f5a3ea41c90f2ab12f5118b /tools | |
parent | 9ed6aa677660008f3619cff5dce7f1949d1c73bf (diff) |
lib/igt_device_scan: Return true from igt_device_find_first_i915_discrete_card()
So that we can also print a relevant error message when failing to find any devices in
intel_gpu_top.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/intel_gpu_top.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index cae01c25..79a936ff 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -1394,15 +1394,18 @@ int main(int argc, char **argv) if (opt_device != NULL) { ret = igt_device_card_match(opt_device, &card); - if (!ret) { + if (!ret) fprintf(stderr, "Requested device %s not found!\n", opt_device); - free(opt_device); - ret = EXIT_FAILURE; - goto exit; - } free(opt_device); } else { - igt_device_find_first_i915_discrete_card(&card); + ret = igt_device_find_first_i915_discrete_card(&card); + if (!ret) + fprintf(stderr, "No device filter specified and no discrete i915 devices found\n"); + } + + if (!ret) { + ret = EXIT_FAILURE; + goto exit; } if (card.pci_slot_name[0] && !is_igpu_pci(card.pci_slot_name)) |