From patchwork Mon Apr 13 08:32:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonyoung Shim X-Patchwork-Id: 6206541 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1C26CBF4A6 for ; Mon, 13 Apr 2015 08:32:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A822201F5 for ; Mon, 13 Apr 2015 08:32:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B2314201F4 for ; Mon, 13 Apr 2015 08:32:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D077B6E23D; Mon, 13 Apr 2015 01:32:04 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F31E6E23C for ; Mon, 13 Apr 2015 01:32:03 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NMQ00BUHL1ELTB0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 13 Apr 2015 17:32:02 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 93.9F.24422.10F7B255; Mon, 13 Apr 2015 17:32:01 +0900 (KST) X-AuditID: cbfee68f-f793b6d000005f66-d9-552b7f015c62 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 63.30.25346.10F7B255; Mon, 13 Apr 2015 17:32:01 +0900 (KST) Received: from localhost.localdomain ([10.252.81.123]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NMQ00FR6L1DR700@mmp1.samsung.com>; Mon, 13 Apr 2015 17:32:01 +0900 (KST) From: Joonyoung Shim To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 3/5] modetest: fix to proper error path handling Date: Mon, 13 Apr 2015 17:32:16 +0900 Message-id: <1428913938-5850-3-git-send-email-jy0922.shim@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1428913938-5850-1-git-send-email-jy0922.shim@samsung.com> References: <1428913938-5850-1-git-send-email-jy0922.shim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFLMWRmVeSWpSXmKPExsWyRsSkWJexXjvUYF6DrcWVr+/ZLPZcvcdk 8eLeRRYHZo+ds+6ye9zvPs7k0bdlFWMAcxSXTUpqTmZZapG+XQJXxpk9wgUTBSp+/1vD1MB4 haeLkZNDQsBE4vXDW6wQtpjEhXvr2UBsIYGljBKT5gTC1LSfuczYxcgFFF/EKPH0xQqooh+M El8W8oLYbAJ6Ene2HWcCsUUElCX+TlzFCGIzC5hKNN08CGYLC7hLLD3VDFbDIqAq0Xr0FtAc Dg5eATeJ3xv4IHbJSZw8NpkVJMwJVH79SAnEJjeJuVNnM4GcICHwmk1i6pSX7BBjBCS+TT7E AlIvISArsekAM8QYSYmDK26wTGAUXsDIsIpRNLUguaA4Kb3IWK84Mbe4NC9dLzk/dxMjMEhP /3vWv4Px7gHrQ4wCHIxKPLwX7miFCrEmlhVX5h5iNAXaMJFZSjQ5HxgLeSXxhsZmRhamJqbG RuaWZkrivAulfgYLCaQnlqRmp6YWpBbFF5XmpBYfYmTi4JRqYEy+NJGzfnZ5bojHMdmPKw/V KBT7v3p24L+IxYY9ScILbpzUWft4veCNICY2SbGkPa8n3ja/OHee5bEbCUcSUkoC1//ZKh7p s/1ndI90hfHUl8vfVgW9P8fN/OKDTaJU1Aqp+mfK7TO6309f+s2q7tJNy6PPJHwdJbR/t1Qw T/x7+/Hq3TkcLp5KLMUZiYZazEXFiQA1UzyUTQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplkeLIzCtJLcpLzFFi42I5/e+xgC5jvXaowaqdphZXvr5ns9hz9R6T xYt7F1kcmD12zrrL7nG/+ziTR9+WVYwBzFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYG hrqGlhbmSgp5ibmptkouPgG6bpk5QKuUFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1 GBmggYQ1jBln9ggXTBSo+P1vDVMD4xWeLkZODgkBE4n2M5cZIWwxiQv31rN1MXJxCAksYpR4 +mIFG0hCSOAHo8SXhbwgNpuAnsSdbceZQGwRAWWJvxNXgTUzC5hKNN08CGYLC7hLLD3VDFbD IqAq0Xr0FtAcDg5eATeJ3xv4IHbJSZw8NpkVJMwJVH79SAnEJjeJuVNnM01g5F3AyLCKUTS1 ILmgOCk911CvODG3uDQvXS85P3cTIzgKnkntYFzZYHGIUYCDUYmH98IdrVAh1sSy4srcQ4wS HMxKIrx1mdqhQrwpiZVVqUX58UWlOanFhxhNgW6ayCwlmpwPjNC8knhDYxMzI0sjc0MLI2Nz JXHeObpyoUIC6YklqdmpqQWpRTB9TBycUg2M2y+4ureY7PjT9bv08L0bOmy77mp/Wrml6qEC e5yZf9Z25X6RE9X96v9nudp/UVr+p5GdVde37FI+Q+7+Vc5F1xR9glw2K90udmna57er2ITn RJ/hprPBMVP5trM98lE4JR8pLy9VUqh4Kqpt1YEfjl+y976K6lvYOTPuz+sTwhML8h5X5X5W YinOSDTUYi4qTgQAKH+ir5gCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch needs to destroy and to remove buffer and framebuffer properly from error path of set_mode and test_page_flip. Signed-off-by: Joonyoung Shim --- tests/modetest/modetest.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 6377459..eec4fd8 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1074,6 +1074,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) { @@ -1082,6 +1084,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]; @@ -1109,9 +1113,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) @@ -1192,7 +1193,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++) { @@ -1206,7 +1207,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; @@ -1258,7 +1259,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); }