From patchwork Fri Jul 15 12:30:19 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: 9231873 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 1F3A26075D for ; Fri, 15 Jul 2016 12:30:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F14F27FB7 for ; Fri, 15 Jul 2016 12:30:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 032EC2832C; Fri, 15 Jul 2016 12:30:50 +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 8FFD127FB7 for ; Fri, 15 Jul 2016 12:30:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 128896E9DF; Fri, 15 Jul 2016 12:30:43 +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 [212.227.15.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7842D6E9DF for ; Fri, 15 Jul 2016 12:30:39 +0000 (UTC) Received: from [192.168.1.2] ([77.182.179.66]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MZleQ-1bf19H10xC-00LVvS; Fri, 15 Jul 2016 14:30:29 +0200 Subject: [PATCH] drm/bochs: Delete an unnecessary check before drm_gem_object_unreference_unlocked() To: David Airlie , Gerd Hoffmann , dri-devel@lists.freedesktop.org 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> From: SF Markus Elfring Message-ID: <1e3a8c0d-e737-f092-727e-af7e3810b8dc@users.sourceforge.net> Date: Fri, 15 Jul 2016 14:30:19 +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: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:DG7BAg488PniWliTBDbh2rXw3M/tVOGXRxmQtO+PQlJREKDFWFu xJbC30Ey8IRm/+WM17G4M/c0IrWZKzh2jNgZugECQ70s6rWZW9cf9BFh6WW1oDHZGZuoUZG jgxuJCyHQ51Lr4LqQqHmyuwBz9lP5EkNINapOJZ5ta4SlfY1DBaHq6Fu6aCueGvBvAufZ70 VYfNpK1Z+G9jGBmfB3IIQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:0jnGC/cWL6g=:HzeMw3cXmqWzB1v981FM3D hUN9zwJTj3hHNJMpmKMqSAxWdF1G4LIXN2C1nOi4NcFr0kGEe6UKqQbKEUX0qeRIuzAQ1pzhJ zqDJakbUm/MVVptSKcOkcHWRmxUBYV5Disxqtug12zn19mvUebKxgfeI1GtojglSuwJwg8UnU MVjYVx3tIeWPXtMvF43Xrr075jEDqa6smMIOmU9g2FUm+TSrBTHesi0LJX2FmeIzV1lyJhzAh /MWUgk8WTkSFjHl9f8C00YDyiryGVrCK43iV/AYcS8UWiG9phAdR6sgz+qEW6YnItVQNNUCBV nVSObnznb80qGRvM9mdNTZoYBIirEZDC1BBPGsSxibAriq4axubIZGlEosnsS69qIXtsDZeWT 7wHqforcafle0Sztdu5Lf1c/2LBuYwHZBLCAtwcmsEh8xnSmq19FTm/keUY8MQO8Kr+CCFFfT MVTBGIPXQ9kmDVkNi085WlWJgFh/71apNeEDOWQaA/akSGpU/UNIbMpwlQfrg8jhBnxD36zFk LYK7W6KQVCi/m1V2gs1RjpTSOSB2k9e+KnlSvlskJe5pKnwgM4TUNwLAlqDYnDTPGR+d100ju 3qHBbLZd6UdGutV/iJDeSIQQVBZhELDVTgMbrBTwjHCteU6xVjxf89EYLqe4o5nJ1voMNW2Cn BQAHTb6ow1MpkCkPDt8ctIZNLUUyp9vP/HSE/R8t0DVbqDqgT6gQ947+HF1L9q599AP8qHYo5 uaQ/xt1KDPc5/uqZWmoMJDC84actMuctz6DEyXgx7oPZOGkVcGlnRHl5PIoFWd1qGN5kFBjeR Ze0kJgs 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, 15 Jul 2016 14:23:15 +0200 The drm_gem_object_unreference_unlocked() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/bochs/bochs_mm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c index 6cf912c..28a60a7 100644 --- a/drivers/gpu/drm/bochs/bochs_mm.c +++ b/drivers/gpu/drm/bochs/bochs_mm.c @@ -474,8 +474,8 @@ int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev, static void bochs_user_framebuffer_destroy(struct drm_framebuffer *fb) { struct bochs_framebuffer *bochs_fb = to_bochs_framebuffer(fb); - if (bochs_fb->obj) - drm_gem_object_unreference_unlocked(bochs_fb->obj); + + drm_gem_object_unreference_unlocked(bochs_fb->obj); drm_framebuffer_cleanup(fb); kfree(fb); }