From patchwork Tue Feb 3 14:31:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5768891 Return-Path: X-Original-To: patchwork-linux-media@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 AA3BB9F302 for ; Tue, 3 Feb 2015 14:31:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8795201F2 for ; Tue, 3 Feb 2015 14:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D477F20212 for ; Tue, 3 Feb 2015 14:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965665AbbBCObQ (ORCPT ); Tue, 3 Feb 2015 09:31:16 -0500 Received: from mout.web.de ([212.227.17.12]:58586 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753473AbbBCObN (ORCPT ); Tue, 3 Feb 2015 09:31:13 -0500 Received: from [192.168.1.2] ([78.49.19.127]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0McnqH-1Y1G731j2P-00HzDf; Tue, 03 Feb 2015 15:31:08 +0100 Message-ID: <54D0DBAA.7040607@users.sourceforge.net> Date: Tue, 03 Feb 2015 15:31:06 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab , linux-media@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] [media] V4L2: Delete an unnecessary check before the function call "media_entity_put" 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:Swu33/jrol4zaaTrgSAYwuzsa7GUKCfW/cDC07l/Jj3tuZlXZOC E8srF4dXpiKQjfuxs5SlE/n49RoE5F5r3uxW6sGr32WK1sYmh6ynAS2kwcbsApjsRQpGOd8 ZLoeB6Vk/adxSNc9WajdFXfKm5wiZS5m5b7gx456TpQhfsun/1FPDyGqcNr4+iXRgtaQrcc w1OdniTSrp1NnILOb9pvg== X-UI-Out-Filterresults: notjunk:1; Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Markus Elfring Date: Tue, 3 Feb 2015 15:27:38 +0100 The media_entity_put() 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/media/v4l2-core/v4l2-subdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 543631c..b9ff7fd 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -93,8 +93,7 @@ static int subdev_open(struct file *file) err: #if defined(CONFIG_MEDIA_CONTROLLER) - if (entity) - media_entity_put(entity); + media_entity_put(entity); #endif v4l2_fh_del(&subdev_fh->vfh); v4l2_fh_exit(&subdev_fh->vfh);