From ee03d186124ff6cc27e76fd2054376b1488de5c9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 3 Sep 2023 15:55:18 -0700 Subject: drm_fb: better handle empty modes/connectors results Phil tripped over this when his TV powered off in the midst of playing with rototiller over hdmi output. The NULL mode/connector was being supplied as the til_setting_spec_t.preferred value throwing an assert in til_setting_desc_new(). Just detect this exception and return an error. --- src/drm_fb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/drm_fb.c b/src/drm_fb.c index 0b6e053..a3864d3 100644 --- a/src/drm_fb.c +++ b/src/drm_fb.c @@ -159,6 +159,9 @@ static int connector_desc_generator(const til_settings_t *settings, til_setup_t if (r < 0) return r; + if (!connectors[0]) + return -ENOENT; + r = til_setting_desc_new( settings, &(til_setting_spec_t){ .name = "DRM connector", @@ -269,6 +272,9 @@ static int mode_desc_generator(const til_settings_t *settings, til_setup_t *setu if (r < 0) return r; + if (!modes[0]) + return -ENOENT; + r = til_setting_desc_new( settings, &(til_setting_spec_t){ .name = "DRM video mode", -- cgit v1.2.3