From patchwork Mon Oct 27 05:24:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 5157231 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 762019F349 for ; Mon, 27 Oct 2014 05:33:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E587202B8 for ; Mon, 27 Oct 2014 05:33:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA76B2027D for ; Mon, 27 Oct 2014 05:33:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751190AbaJ0FdD (ORCPT ); Mon, 27 Oct 2014 01:33:03 -0400 Received: from smtprelay0066.hostedemail.com ([216.40.44.66]:48964 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750855AbaJ0FdD (ORCPT ); Mon, 27 Oct 2014 01:33:03 -0400 Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave05.hostedemail.com (Postfix) with ESMTP id 7B29B183E43 for ; Mon, 27 Oct 2014 05:25:27 +0000 (UTC) Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 9AE276A9CC; Mon, 27 Oct 2014 05:25:24 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::, RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3871:4321:4823:5007:6261:8957:10004:10848:11026:11658:11914:12043:12517:12519:12555:13311:13357:14394:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: meat91_4c3b3036d0e17 X-Filterd-Recvd-Size: 1953 Received: from joe-laptop.perches.com (pool-71-103-235-196.lsanca.fios.verizon.net [71.103.235.196]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Mon, 27 Oct 2014 05:25:23 +0000 (UTC) From: Joe Perches To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , linux-input@vger.kernel.org Subject: [PATCH 03/11] aiptek: Fix probable mask then right shift defects Date: Sun, 26 Oct 2014 22:24:59 -0700 Message-Id: <8c6687a4d568c853ab649ba03d2477ee24bc6ff6.1414387334.git.joe@perches.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: References: 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.5 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 Precedence of & and >> is not the same and is not left to right. shift has higher precedence and should be done after the mask. Here the shifts are unnecessary and a non-zero value can be used as the test to set 1 or zero. Signed-off-by: Joe Perches --- drivers/input/tablet/aiptek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index e7f966d..dee2bb9 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -489,9 +489,9 @@ static void aiptek_irq(struct urb *urb) */ jitterable = data[1] & 0x07; - left = (data[1] & aiptek->curSetting.mouseButtonLeft >> 2) != 0 ? 1 : 0; - right = (data[1] & aiptek->curSetting.mouseButtonRight >> 2) != 0 ? 1 : 0; - middle = (data[1] & aiptek->curSetting.mouseButtonMiddle >> 2) != 0 ? 1 : 0; + left = data[1] & aiptek->curSetting.mouseButtonLeft ? 1 : 0; + right = data[1] & aiptek->curSetting.mouseButtonRight ? 1 : 0; + middle = data[1] & aiptek->curSetting.mouseButtonMiddle ? 1 : 0; input_report_key(inputdev, BTN_LEFT, left); input_report_key(inputdev, BTN_MIDDLE, middle);