USB: gtco: remove unnecessary variable assignments
Subsystems (2)
PATCH 1/1 USB: gtco: remove unnecessary variable assignments
Remove unnecessary variable assignments.
Variable _val_ is overwritten before the value stored in it can be used.
Addresses-Coverity-ID: 1397695
--- drivers/input/tablet/gtco.c | 2 -- 1 file changed, 2 deletions(-)
drivers/input/tablet/gtco.c +0 -2
@@ -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 ]);
Signature · 1 line
2.5.0
Quoted 14 lines · Gustavo A. R. Silva
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 <[email protected]>--- drivers/input/tablet/gtco.c | 2 -- 1 file changed, 2 deletions(-)drivers/input/tablet/gtco.c +0
-0
drivers/input/tablet/gtco.c static void gtco_urb_callback(struct urb *urbinfo) · line 656
Quoted 7 lines
drivers/input/tablet/gtco.c +0
-2@@ -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);
Hi Joe, Gustavo,
Quoted 25 lines · Joe Perches
Quoted 14 lines · Gustavo A. R. Silva
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 <[email protected]>--- drivers/input/tablet/gtco.c | 2 -- 1 file changed, 2 deletions(-)drivers/input/tablet/gtco.c +0
-0drivers/input/tablet/gtco.c static void gtco_urb_callback(struct urb *urbinfo) · line 656
Quoted 7 lines
drivers/input/tablet/gtco.c +0
-2@@ -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
Quoted 1 line
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