From patchwork Wed Dec 21 14:41:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 9483119 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 B443B60821 for ; Wed, 21 Dec 2016 14:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7ACA271E0 for ; Wed, 21 Dec 2016 14:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C7DA27F17; Wed, 21 Dec 2016 14:42:12 +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 5F8AA271E0 for ; Wed, 21 Dec 2016 14:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759410AbcLUOly (ORCPT ); Wed, 21 Dec 2016 09:41:54 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:53304 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760327AbcLUOlu (ORCPT ); Wed, 21 Dec 2016 09:41:50 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1cJi5S-0002hA-AI; Wed, 21 Dec 2016 14:41:46 +0000 From: Colin King To: Dmitry Torokhov , Andrew Duggan , Benjamin Tissoires , Lyude Paul , Dennis Wassenberg , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev Date: Wed, 21 Dec 2016 14:41:04 +0000 Message-Id: <20161221144104.25794-1-colin.king@canonical.com> X-Mailer: git-send-email 2.10.2 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King rmi_dev is currently being dereferenced before it null checked, however, after deeper inspecting, rmi_dev can never be null, so just remove this redundant check. Thanks to Dmitry Torokhov for noticing that we can remove the null check. Fixes CoverityScan CID 1391218 ("Dereference before null check") Signed-off-by: Colin Ian King --- drivers/input/rmi4/rmi_f03.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c index 8a7ca3e..9a1b099 100644 --- a/drivers/input/rmi4/rmi_f03.c +++ b/drivers/input/rmi4/rmi_f03.c @@ -175,9 +175,6 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) int i; int error; - if (!rmi_dev) - return -ENODEV; - if (drvdata->attn_data.data) { /* First grab the data passed by the transport device */ if (drvdata->attn_data.size < ob_len) {