From patchwork Mon Feb 16 13:46:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 5835501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0002F9F691 for ; Tue, 17 Feb 2015 00:29:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DAD6201FA for ; Tue, 17 Feb 2015 00:29:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 361C8201FB for ; Tue, 17 Feb 2015 00:29:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A15306E283; Mon, 16 Feb 2015 16:29:31 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.math.uni-bielefeld.de (smtp.math.uni-bielefeld.de [129.70.45.10]) by gabe.freedesktop.org (Postfix) with ESMTP id 115CA6E288 for ; Mon, 16 Feb 2015 05:47:04 -0800 (PST) Received: from chidori.math.uni-bielefeld.de (dhcp24-141.math.uni-bielefeld.de [129.70.24.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id 00BFA600E1; Mon, 16 Feb 2015 14:47:02 +0100 (CET) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 09/15] exynos: use structure initialization instead of memset Date: Mon, 16 Feb 2015 14:46:39 +0100 Message-Id: <1424094405-6314-10-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1424094405-6314-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1424094405-6314-1-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailman-Approved-At: Mon, 16 Feb 2015 16:29:29 -0800 Cc: dri-devel@lists.freedesktop.org, Tobias Jakobi , robclark@freedesktop.org, m.szyprowski@samsung.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 Keeps the code cleaner, since the structs have to be initialized once anyway. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 4 +--- tests/exynos/exynos_fimg2d_test.c | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index c08974a..c6f964b 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -181,7 +181,7 @@ static void g2d_reset(struct g2d_context *ctx) static int g2d_flush(struct g2d_context *ctx) { int ret; - struct drm_exynos_g2d_set_cmdlist cmdlist; + struct drm_exynos_g2d_set_cmdlist cmdlist = {0}; if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0) return FALSE; @@ -191,8 +191,6 @@ static int g2d_flush(struct g2d_context *ctx) return -EINVAL; } - memset(&cmdlist, 0, sizeof(struct drm_exynos_g2d_set_cmdlist)); - cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0]; cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0]; cmdlist.cmd_nr = ctx->cmd_nr; diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c index 446a6c6..cffe11b 100644 --- a/tests/exynos/exynos_fimg2d_test.c +++ b/tests/exynos/exynos_fimg2d_test.c @@ -257,7 +257,7 @@ static void exynos_destroy_buffer(struct exynos_bo *bo) static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst) { struct g2d_context *ctx; - struct g2d_image img; + struct g2d_image img = {0}; unsigned int count, img_w, img_h; int ret = 0; @@ -265,7 +265,6 @@ static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst) if (!ctx) return -EFAULT; - memset(&img, 0, sizeof(struct g2d_image)); img.bo[0] = dst->handle; printf("solid fill test.\n"); @@ -308,7 +307,7 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src, enum e_g2d_buf_type type) { struct g2d_context *ctx; - struct g2d_image src_img, dst_img; + struct g2d_image src_img = {0}, dst_img = {0}; unsigned int count; unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h; unsigned long userptr, size; @@ -318,8 +317,6 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src, if (!ctx) return -EFAULT; - memset(&src_img, 0, sizeof(struct g2d_image)); - memset(&dst_img, 0, sizeof(struct g2d_image)); dst_img.bo[0] = dst->handle; src_x = 0; @@ -392,7 +389,7 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev, enum e_g2d_buf_type type) { struct g2d_context *ctx; - struct g2d_image src_img, dst_img; + struct g2d_image src_img = {0}, dst_img = {0}; unsigned int count; unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h; unsigned long userptr, size; @@ -402,8 +399,6 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev, if (!ctx) return -EFAULT; - memset(&src_img, 0, sizeof(struct g2d_image)); - memset(&dst_img, 0, sizeof(struct g2d_image)); dst_img.bo[0] = dst->handle; src_x = 0; @@ -481,7 +476,7 @@ static int g2d_blend_test(struct exynos_device *dev, enum e_g2d_buf_type type) { struct g2d_context *ctx; - struct g2d_image src_img, dst_img; + struct g2d_image src_img = {0}, dst_img = {0}; unsigned int count; unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h; unsigned long userptr, size; @@ -491,8 +486,6 @@ static int g2d_blend_test(struct exynos_device *dev, if (!ctx) return -EFAULT; - memset(&src_img, 0, sizeof(struct g2d_image)); - memset(&dst_img, 0, sizeof(struct g2d_image)); dst_img.bo[0] = dst->handle; src_x = 0;