From patchwork Sat Nov 29 14:33:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5406751 X-Patchwork-Delegate: jikos@jikos.cz 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 96D9D9F443 for ; Sat, 29 Nov 2014 14:33:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB49B200F3 for ; Sat, 29 Nov 2014 14:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6FD0200DC for ; Sat, 29 Nov 2014 14:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750862AbaK2Odn (ORCPT ); Sat, 29 Nov 2014 09:33:43 -0500 Received: from mout.web.de ([212.227.17.12]:52450 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750833AbaK2Odn (ORCPT ); Sat, 29 Nov 2014 09:33:43 -0500 Received: from [192.168.1.2] ([78.49.36.109]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LtFUV-1Y1QDY308J-012q7U; Sat, 29 Nov 2014 15:33:39 +0100 Message-ID: <5479D93E.3040407@users.sourceforge.net> Date: Sat, 29 Nov 2014 15:33:34 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jiri Kosina , linux-input@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Coccinelle Subject: [PATCH 1/1] HID: Wacom: Deletion of unnecessary checks 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:nPOHDh0H75MD2irSlYunOJ6Qs/0KOwvsKWn7yUo+M2aB+w4IdrS h8SKkADfoIkxQg/i5BcsGPNju7U5omRQQhugHocxCxelm93l2+6OKgSq1MtCRpARAnSLnOm RuwBpN9f/lLOW6dLczS+p2/c+sDdcsWdH4n8CkYLTVJYMI6vKpa59fDhKQFyJbkYCm62Mhc x50UmIntyM0BiaKCT1r2w== 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: Sat, 29 Nov 2014 15:16:01 +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/hid/wacom_sys.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index eb55316..21ced00 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1099,10 +1099,8 @@ static void wacom_free_inputs(struct wacom *wacom) { struct wacom_wac *wacom_wac = &(wacom->wacom_wac); - if (wacom_wac->input) - input_free_device(wacom_wac->input); - if (wacom_wac->pad_input) - input_free_device(wacom_wac->pad_input); + input_free_device(wacom_wac->input); + input_free_device(wacom_wac->pad_input); wacom_wac->input = NULL; wacom_wac->pad_input = NULL; }