From patchwork Thu Feb 5 16:40:20 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: 5785611 Return-Path: X-Original-To: patchwork-linux-input@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 3D7E59F336 for ; Thu, 5 Feb 2015 16:40:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74E45201FA for ; Thu, 5 Feb 2015 16:40:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F73B2013A for ; Thu, 5 Feb 2015 16:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758094AbbBEQk2 (ORCPT ); Thu, 5 Feb 2015 11:40:28 -0500 Received: from mout.web.de ([212.227.17.11]:59681 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757971AbbBEQk1 (ORCPT ); Thu, 5 Feb 2015 11:40:27 -0500 Received: from [192.168.1.2] ([92.228.134.1]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M8i11-1XNIyZ0W9b-00wDGx; Thu, 05 Feb 2015 17:40:24 +0100 Message-ID: <54D39CF4.7030204@users.sourceforge.net> Date: Thu, 05 Feb 2015 17:40:20 +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: Dmitry Torokhov , linux-input@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] Input: Delete an unnecessary check before the function call "input_free_device" 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:HTrb390E0JsnT9ZAL0CwOT0Y2Jjah1nP0ki1r64xD932/SraAD2 lbGf9gW8BjzxqcmWmTwrb7FcZw24nwPa9rLLuw17X13Cf/ZtrkP9abkqp435wxgVSEqy/RF pViVMT5dakK1AYTFT9gZ906xyGwO6oRmhPTILxZI56spSsoUOm6LUtyhSETGKzN3u6Wn5c4 n5vMb7skvTUpTwPzBFsdQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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=ham 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: Thu, 5 Feb 2015 17:35:35 +0100 The input_free_device() 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/input/joystick/adi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index b784257..d09cefa 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -535,8 +535,7 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv) } } fail2: for (i = 0; i < 2; i++) - if (port->adi[i].dev) - input_free_device(port->adi[i].dev); + input_free_device(port->adi[i].dev); gameport_close(gameport); fail1: gameport_set_drvdata(gameport, NULL); kfree(port);