aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchiminghao <[email protected]>2021-11-09 08:26:10 +0000
committerBenjamin Tissoires <[email protected]>2021-12-14 10:50:23 +0100
commit415e701cee5228f168049881624e343d9a3d97bb (patch)
tree9d4a53dd8b79f11d2e625e5e55cff1023f969463
parent03090cc76ee3298cc70bce26bbe93a0cb50e42a2 (diff)
HID: thrustmaster use swap() to make code cleaner
Fix the following coccicheck REVIEW: Use swap() instead of reimplementing it. Reported-by: Zeal Robot <[email protected]> Signed-off-by: chiminghao <[email protected]> [bentiss: rewrote commit title] Signed-off-by: Benjamin Tissoires <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--drivers/hid/hid-tmff.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c
index 90acef304536..4040cd98dafe 100644
--- a/drivers/hid/hid-tmff.c
+++ b/drivers/hid/hid-tmff.c
@@ -78,7 +78,6 @@ static int tmff_play(struct input_dev *dev, void *data,
struct hid_field *ff_field = tmff->ff_field;
int x, y;
int left, right; /* Rumbling */
- int motor_swap;
switch (effect->type) {
case FF_CONSTANT:
@@ -104,11 +103,8 @@ static int tmff_play(struct input_dev *dev, void *data,
ff_field->logical_maximum);
/* 2-in-1 strong motor is left */
- if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT) {
- motor_swap = left;
- left = right;
- right = motor_swap;
- }
+ if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT)
+ swap(left, right);
dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
ff_field->value[0] = left;