From patchwork Thu Jul 9 06:08:15 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: 6753201 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F2FF89F380 for ; Thu, 9 Jul 2015 06:08:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 209DB2064C for ; Thu, 9 Jul 2015 06:08:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 490BA2041A for ; Thu, 9 Jul 2015 06:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751855AbbGIGIf (ORCPT ); Thu, 9 Jul 2015 02:08:35 -0400 Received: from mout.web.de ([212.227.15.14]:51272 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525AbbGIGId (ORCPT ); Thu, 9 Jul 2015 02:08:33 -0400 Received: from [192.168.1.2] ([78.48.42.160]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MeBVG-1ZMV2h0lm2-00PvD3; Thu, 09 Jul 2015 08:08:29 +0200 Subject: [PATCH v2] HID: Wacom: Delete unnecessary checks before the function call "input_free_device" To: Jiri Kosina , linux-input@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> <5479D93E.3040407@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Message-ID: <559E0FCF.8000908@users.sourceforge.net> Date: Thu, 9 Jul 2015 08:08:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <5479D93E.3040407@users.sourceforge.net> X-Provags-ID: V03:K0:z9GFF4a6IcVkET8epQTLsFP8IeFqG+wInmJnKHSFsHAWViXL/ec 9qwT3//u6ufpjSZ6xDu6TpV/BVD7Fn+TO0YZ+zodT2LwTvKYNo1co/LMqtAIR6o4mYsPEGU G6ff+VZtflea/C3rHvGdTXVVUammRuy2yENqQcgg77h3FhWpdAFCvrbgsK6ZgCkFMh3AzCT Ch/01QeUYLINxVvv2vwAQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:HDm7IxWKU9U=:SrQlJzPQ9Jyu0IfkH9QT67 Glhk518Q3Jun0ghF3Gy6R8B8FhuniTA6Fxgz/JhpZvDQoh1QXmIEEQYkffJeuay9iJTQL6rV9 Cd1TgFOmeFZnPoeEMHE6USmdwy5qUiN8jZoLR6TEYq+tM5pChxuJwLgx12WpNC8nfiywpCGwm 5C+Zyd4i0gYfNVjHAzJ0E8vdN+o8lq1a3xbrZe1uNFFwTTvkSFJKPYwa+WRGbAQQJSU2sZi7u ScPSbpyvtfL5l0cFpBydnZ0I/H/gYrxpYQFOfZorGM80YcZRtXfjo87RhqKKvozZSqeVvNxmq APd1D7fVbb6xuv5pvVH6tBjH+z91YOKCFyXUNHRimJNaWZNJFNhYmH8KS2k0dgr2/BAoSp5wZ WPRJtdkoctw5yJRudkeYiW0/RuV6nvn9KzJH/p5gdxBSKHjNvt3jlIffnT3/rXPWwDG24OkCu w/LQoiNyUucXjnXRh9w4JU6x3pHwywIWVNs/oRBI1vnFfAPz8ZdOE/NDw+jpyGxd7m+zk2PS2 DqHYup+vIVAudzbEd9dDfRSsRR+tehuWO+RhJGQToZQ4/0qMlcWrstD60ijKC/jxAH73NIAA4 r8cD2F3chxLnRUFedQUtcdMprcbgOm78deqz68nNA4MpWJ+dCFPp34G5V0WPnXqc7dc5pyqvD Kwc72yyRNAJLaOGk1+KPqpWQ3dNRJz1Azv1cB3flzCzRJms3oWz/jBdIoWZ2IdkYfPXo= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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, 9 Jul 2015 08:00:10 +0200 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 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 4c0ffca..936ad77 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1149,12 +1149,9 @@ static void wacom_free_inputs(struct wacom *wacom) { struct wacom_wac *wacom_wac = &(wacom->wacom_wac); - if (wacom_wac->pen_input) - input_free_device(wacom_wac->pen_input); - if (wacom_wac->touch_input) - input_free_device(wacom_wac->touch_input); - if (wacom_wac->pad_input) - input_free_device(wacom_wac->pad_input); + input_free_device(wacom_wac->pen_input); + input_free_device(wacom_wac->touch_input); + input_free_device(wacom_wac->pad_input); wacom_wac->pen_input = NULL; wacom_wac->touch_input = NULL; wacom_wac->pad_input = NULL;