From patchwork Fri Jul 22 11:45:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9243409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB1BE60757 for ; Fri, 22 Jul 2016 11:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABD7F2026B for ; Fri, 22 Jul 2016 11:46:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A015927F95; Fri, 22 Jul 2016 11:46:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EE052026B for ; Fri, 22 Jul 2016 11:46:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC02D6EB49; Fri, 22 Jul 2016 11:46:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [217.72.192.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CCC86EB49 for ; Fri, 22 Jul 2016 11:46:09 +0000 (UTC) Received: from [192.168.1.2] ([77.182.75.73]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0M3k4b-1b9RYN1lGj-00rHOU; Fri, 22 Jul 2016 13:45:42 +0200 Subject: [PATCH] drm/vmwgfx: Delete an unnecessary check before the function call "vfree" To: linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org, David Airlie , Junwang Zhao , Thomas Hellstrom , Sinclair Yeh References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <546CCB7E.3050109@users.sourceforge.net> <559A35C9.8050201@users.sourceforge.net> From: SF Markus Elfring Message-ID: <8060f2e9-5070-3c10-d55c-dc058e4ca20d@users.sourceforge.net> Date: Fri, 22 Jul 2016 13:45:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <559A35C9.8050201@users.sourceforge.net> X-Provags-ID: V03:K0:648yY0xYcGEQFg/yrpm/X/CUToTsT34lml4+aMbnd9mwItHdqBu YsmGU9oNB5MBNKDKviEOaa5LkCOs0joigwJdapv83CZMpo2ePhKysvpnNhKjgoGjPhiX4Ad 5oyr1gC8YMjYEKkm8LjvphKDyIPPM5b2MfZzi4CqvfGANtiDEG0WiOQn9ixbhlobcCZun0i jgxqAGlwzHlKvvtBk2AfA== X-UI-Out-Filterresults: notjunk:1; V01:K0:qzaH1gEMS5Q=:9wBgJe9ufP+TJgKnqtTdCr kJMVqtXl0Zojy0+M1s/otj8uJoRpYZsLsiDLd9XCLvuk0JtA6FOCZhXkKDsl1LAlVs2ZO2I0r /wWTTVgHKihKjjUd0M98yaKmztsZnJ4ZHpKPKm85Bqd+6SMXPYYxoys7+aNnrXqjTwenLOj1A FadH+/wO/H6EDjxN5+3t0uyTA5TkneB3CWb9EJz2fffj36GbhI3GpsD/1wWCa/jR8lgYB7AJF Ifxr0cGm91F7lWXUIXzEISr9Y1u52makgtTMzdvYKfic2Trocu1xXrFsRz2i4eF+/UvDsu5qi 31rP+YRo1isko/V0pj3aOuBdDTqbDLqOlQXv192RWqjl+LJOnj0fnAcaTEP+0wchAdGlF0Veg 5VnXo9SkbxAnD1XFhmVV/BbKMCPYGocvU+RJ33qGge47vgUJp4ZzLY/FPQxht5pW6elcGJdBo t1krooyVG1p+I/v3GlRmtUfPExggvqQZEE8we+HzHInKaSwbWOW6vYa52v3rUkY7fECJ1czJO uhSHoJV7qF4bQ1SMOXdtxSrcqJoYrGsDrUBHxYdSNp5lxlQOeO/WY0B8jW/zr+0A4tSzs8St4 kORFuZHxuK/IOSDlwyDIaVoA3cfJxBk50R7eb6kfgotxmZUuB4soMw8NUVQJWPFGzRL0Nt6Gs ExtsHzIWJKW8iM25k9uydtw/qhOEZB5MHiaBvCX/10Z6oqOlc54A458XVGpGULfcDcSyRzDFu rZ/eo9vZlr/hG2z4+AFNvBNw6zvXkV4NytQ3Z7HkXFwrKZoSAfNSPMapEB/T7Rcz5zJwyYk/e qkZpGUZ Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 22 Jul 2016 13:31:00 +0200 The vfree() function performs also input parameter validation. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 1a1a87c..dc5beff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3625,9 +3625,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); } - if (sw_context->cmd_bounce != NULL) - vfree(sw_context->cmd_bounce); - + vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); if (sw_context->cmd_bounce == NULL) {