diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2015-04-13 17:32:16 +0900 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-04-28 13:04:49 +0100 |
commit | 21170a8c63d2e994317b785f7f7e78ab7e0a4ac4 (patch) | |
tree | 4b9290b301c5eef60d1e91527aded8bc46365ca4 /tests | |
parent | bcaaa75cf482c7d218340c850ffc01f04b78b3dd (diff) |
modetest: fix the error path handling
Remove the framebuffer and destroy the bo when error occurs on set_mode
and test_page_flip.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/modetest/modetest.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 66d13c50..f2307f29 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1080,6 +1080,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co if (bo == NULL) return; + dev->mode.bo = bo; + ret = drmModeAddFB2(dev->fd, dev->mode.width, dev->mode.height, pipes[0].fourcc, handles, pitches, offsets, &fb_id, 0); if (ret) { @@ -1088,6 +1090,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co return; } + dev->mode.fb_id = fb_id; + x = 0; for (i = 0; i < count; i++) { struct pipe_arg *pipe = &pipes[i]; @@ -1115,9 +1119,6 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co return; } } - - dev->mode.bo = bo; - dev->mode.fb_id = fb_id; } static void clear_mode(struct device *dev) @@ -1198,7 +1199,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned &other_fb_id, 0); if (ret) { fprintf(stderr, "failed to add fb: %s\n", strerror(errno)); - return; + goto err; } for (i = 0; i < count; i++) { @@ -1212,7 +1213,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned pipe); if (ret) { fprintf(stderr, "failed to page flip: %s\n", strerror(errno)); - return; + goto err_rmfb; } gettimeofday(&pipe->start, NULL); pipe->swap_count = 0; @@ -1264,7 +1265,9 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned drmHandleEvent(dev->fd, &evctx); } +err_rmfb: drmModeRmFB(dev->fd, other_fb_id); +err: bo_destroy(other_bo); } |