diff options
-rw-r--r-- | kms++util/inc/kms++util/kms++util.h | 6 | ||||
-rw-r--r-- | utils/kmstest.cpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h index 3745a31..c1e3c8c 100644 --- a/kms++util/inc/kms++util/kms++util.h +++ b/kms++util/inc/kms++util/kms++util.h @@ -63,3 +63,9 @@ void draw_test_pattern(IMappedFramebuffer &fb); fprintf(stderr, fmt "\n", ##__VA_ARGS__); \ exit(-1); \ } while(0) + +#define EXIT_IF(x, fmt, ...) \ + if (unlikely(x)) { \ + fprintf(stderr, fmt "\n", ##__VA_ARGS__); \ + exit(-1); \ + } diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 32dcb69..e412f90 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -497,7 +497,9 @@ static vector<OutputInfo> setups_to_outputs(Card& card, ResourceManager& resman, OutputInfo output = { }; output.connector = resman.reserve_connector(conn); + EXIT_IF(!output.connector, "Failed to reserve connector %s", conn->fullname().c_str()); output.crtc = resman.reserve_crtc(conn); + EXIT_IF(!output.crtc, "Failed to reserve crtc for %s", conn->fullname().c_str()); output.mode = output.connector->get_default_mode(); output.fbs = get_default_fb(card, output.mode.hdisplay, output.mode.vdisplay); |