From patchwork Wed Dec 9 10:22:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7806891 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 D03939F39B for ; Wed, 9 Dec 2015 10:22:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D5D8204AB for ; Wed, 9 Dec 2015 10:22:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA29620483 for ; Wed, 9 Dec 2015 10:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754424AbbLIKWe (ORCPT ); Wed, 9 Dec 2015 05:22:34 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:16622 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754375AbbLIKWb (ORCPT ); Wed, 9 Dec 2015 05:22:31 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tB9AMJCf028539 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Dec 2015 10:22:20 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id tB9AMJpV016162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 9 Dec 2015 10:22:19 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tB9AMJ7l005854; Wed, 9 Dec 2015 10:22:19 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 Dec 2015 02:22:18 -0800 Date: Wed, 9 Dec 2015 13:22:05 +0300 From: Dan Carpenter To: Jiri Kosina , Jason Gerecke Cc: Benjamin Tissoires , Henrik Rydberg , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] HID: wacom: bitwise vs logical ORs Message-ID: <20151209102205.GB3173@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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=unavailable 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 Smatch complains that these should probably be bitwise ORs instead of logical. It doesn't matter for "prox" but it makes a difference for "strip1" and "strip2". Fixes: c7f0522a1ad1 ('HID: wacom: Slim down wacom_intuos_pad processing') Signed-off-by: Dan Carpenter Reviewed-by: Jason Gerecke --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 7cf0417..af330aa 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -545,12 +545,12 @@ static int wacom_intuos_pad(struct wacom_wac *wacom) ((data[6] & 0x0F) << 4) | (data[5] & 0x0F); } - strip1 = (data[1] << 8) || data[2]; - strip2 = (data[3] << 8) || data[4]; + strip1 = (data[1] << 8) | data[2]; + strip2 = (data[3] << 8) | data[4]; } - prox = (buttons & ~(~0 << nbuttons)) || (keys & ~(~0 << nkeys)) || - (ring1 & 0x80) || (ring2 & 0x80) || strip1 || strip2; + prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) | + (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; wacom_report_numbered_buttons(input, nbuttons, buttons);