Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbdFOUCj (ORCPT ); Thu, 15 Jun 2017 16:02:39 -0400 Received: from e2big.org ([198.61.226.133]:33099 "EHLO e2big.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbdFOUCi (ORCPT ); Thu, 15 Jun 2017 16:02:38 -0400 X-Greylist: delayed 2229 seconds by postgrey-1.27 at vger.kernel.org; Thu, 15 Jun 2017 16:02:37 EDT Date: Thu, 15 Jun 2017 21:25:18 +0200 From: ulrik.debie-os@e2big.org To: Joe Perches Cc: "Gustavo A. R. Silva" , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: gtco: remove unnecessary variable assignments Message-ID: <20170615192517.4giikw5z7etu56a6@beacon.debie> References: <20170615015029.GA5601@embeddedgus> <1497502848.14396.2.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1497502848.14396.2.camel@perches.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "e2big.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Hi Joe, Gustavo, On Wed, Jun 14, 2017 at 10:00:48PM -0700, Joe Perches wrote: > On Wed, 2017-06-14 at 20:50 -0500, Gustavo A. R. Silva wrote: > > Remove unnecessary variable assignments. > > Variable _val_ is overwritten before the value stored in it can be used. > > > > Addresses-Coverity-ID: 1397695 > > Signed-off-by: Gustavo A. R. Silva > > --- > > drivers/input/tablet/gtco.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c > > index b796e89..d9de13c 100644 > > --- a/drivers/input/tablet/gtco.c > > +++ b/drivers/input/tablet/gtco.c > > @@ -652,8 +652,6 @@ static void gtco_urb_callback(struct urb *urbinfo) > > switch (device->buffer[0]) { > > case 5: > > /* Pressure is 9 bits */ > > - val = ((u16)(device->buffer[8]) << 1); > > - val |= (u16)(device->buffer[7] >> 7); > > input_report_abs(inputdev, ABS_PRESSURE, > > device->buffer[8]); > > Perhaps more likely to be > > input_report_abs(inputdev, ABS_PRESSURE, val); [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1359 Lines: 39 Hi Joe, Gustavo, On Wed, Jun 14, 2017 at 10:00:48PM -0700, Joe Perches wrote: > On Wed, 2017-06-14 at 20:50 -0500, Gustavo A. R. Silva wrote: > > Remove unnecessary variable assignments. > > Variable _val_ is overwritten before the value stored in it can be used. > > > > Addresses-Coverity-ID: 1397695 > > Signed-off-by: Gustavo A. R. Silva > > --- > > drivers/input/tablet/gtco.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c > > index b796e89..d9de13c 100644 > > --- a/drivers/input/tablet/gtco.c > > +++ b/drivers/input/tablet/gtco.c > > @@ -652,8 +652,6 @@ static void gtco_urb_callback(struct urb *urbinfo) > > switch (device->buffer[0]) { > > case 5: > > /* Pressure is 9 bits */ > > - val = ((u16)(device->buffer[8]) << 1); > > - val |= (u16)(device->buffer[7] >> 7); > > input_report_abs(inputdev, ABS_PRESSURE, > > device->buffer[8]); > > Perhaps more likely to be > > input_report_abs(inputdev, ABS_PRESSURE, val); Probably that was the original intention but changing it that way now would give a shift of factor 2 to userspace. But if the 2 lines are deleted, I would update the comment above it so it is clear the lowest significant bit in buffer[7] is not included in the report call. Kind regards, Ulrik