From patchwork Wed Jul 13 18:02:20 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: 9228345 X-Patchwork-Delegate: agross@codeaurora.org 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 5767D6088F for ; Wed, 13 Jul 2016 18:03:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D51727FE4 for ; Wed, 13 Jul 2016 18:03:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41B31280DE; Wed, 13 Jul 2016 18:03:46 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E7292807B for ; Wed, 13 Jul 2016 18:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751254AbcGMSD1 (ORCPT ); Wed, 13 Jul 2016 14:03:27 -0400 Received: from mout.web.de ([212.227.15.14]:64809 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbcGMSD0 (ORCPT ); Wed, 13 Jul 2016 14:03:26 -0400 Received: from [192.168.1.2] ([78.53.182.169]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MS29q-1bpYH93026-00TE3s; Wed, 13 Jul 2016 20:02:21 +0200 Subject: [PATCH 3/3] drm/msm: Delete an unnecessary check before drm_gem_object_unreference() To: David Airlie , Rob Clark , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.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> <351a1279-b0ca-5f5e-d175-28c9de8406f6@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <78fbe696-0f73-b396-a986-064f2ad9f22a@users.sourceforge.net> Date: Wed, 13 Jul 2016 20:02:20 +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: <351a1279-b0ca-5f5e-d175-28c9de8406f6@users.sourceforge.net> X-Provags-ID: V03:K0:4XR7Dvy+JK7jmtPaYFErJV18fNvuNA7JZkkk9MNdTSvJIQxZ8BO ADLWlJ9NzBieu0bgTAUg9boXXKPml4MMyh4E+yTi19E751Ccb0hiPkSE1AEXKr1J9xcKbn7 heAf6ZM2jfZUyLl5BNYxAHYw3sfqsJ+eoLhhnOsBVqJZlSHP5h79S2S7qyPpeH9pzFzz9al YQBnFrKTdrLC0Ltgq+KAw== X-UI-Out-Filterresults: notjunk:1; V01:K0:wh7AULzl7rY=:uODOn+LdK6F6ncmyMgOYlI q2RBdNyo/xOQW2Q1C/MPtC1qr4xm0fR9gXHouxRCy5MS5HKAi3wVJt9NriXFAjMEWA6EzqS+R Ga7IpTR+HBm4egMfUwUK0eVjsoB8JLPyjr7kEM+o3o+RCA4p73pGcKW40nSLjKe8nkU56YaXb kR1nvOVhzWsynXS3P8KbBpkroKMFYMLPazfCIaqOVcNg/HLrfdkg9v3LH3hgoKDioOgkKRV8d AXk8c58nw8JBfnObTQmgt6OQ9exz6Tm00OfrwxxWQwLmuEGrR44LCeef+vXymbr6BFUZ3WEJY piHxc9ozlfMSllJCYMbnWtra17vlwEz9Chi5dPcz+ttqoxvaUoNYgmRueEasUpVWyObNuIWzq +vLX6jpvui5hGsvC0bIbIgzpkREGn5O+zBrQ8lh4e6nR6t3uq3wmqfDEBPEijWeXdIfYVtKea keqKwQ49Y7FZG9zesB4LfQCMADhCrCP2erhUxRPhDgB6Eft21RaAhv/c+PlrSQQV7oQIrEV2F cxT1GCBoRFR82+ve0aDRAAPWJrXGF16qf8Ujf2bPrT4KhU5MVYn5MJGOWl+edov4VDgn0sLt0 rwC/q8VOTnzJa6ydbyrgh9tc6Cfccy8DqpSOTvnYUJ2Tgz2bi6viyk7nj9UBTfppzmMNDR8h7 vRrJ03TRwFgBGIt1F974QKn6cc8GP+mJQhgCuf94FIrWZfOKWQqraxw/haU/fNHrk/SH+CPen 1Wkn/QLJ/VsMuISl0YMWDk4Od6L3B0M5PzO+aQR9ncIG3tddLdThkXuxGwehzZPda1ZD6sntI 5C9s+hL Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 13 Jul 2016 19:29:19 +0200 The drm_gem_object_unreference() 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/msm/msm_gem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 9a713fb..6cd4af4 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -830,9 +830,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, return obj; fail: - if (obj) - drm_gem_object_unreference(obj); - + drm_gem_object_unreference(obj); return ERR_PTR(ret); }