lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211027235244.6164-1-lv.ruyi@zte.com.cn>
Date:   Wed, 27 Oct 2021 23:52:44 +0000
From:   Lv Ruyi <cgel.zte@...il.com>
To:     Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>
Cc:     Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] HID: use swap() to make code cleaner

From: Yang Guang <yang.guang5@....com.cn>

Using swap() make it more readable.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Yang Guang <yang.guang5@....com.cn>
---
 drivers/hid/hid-tmff.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c
index 90acef304536..f5b902d1a174 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:
@@ -105,9 +104,7 @@ static int tmff_play(struct input_dev *dev, void *data,
 
 		/* 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;
+			swap(left, right);
 		}
 
 		dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ