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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO-hwJL5wqfF48FFyGXFyLcuRJ0czJJjt9g=7jfdcSCumACfcQ@mail.gmail.com>
Date:   Tue, 14 Dec 2021 13:29:57 +0100
From:   Benjamin Tissoires <benjamin.tissoires@...hat.com>
To:     cgel.zte@...il.com
Cc:     Jiri Kosina <jikos@...nel.org>,
        "open list:HID CORE LAYER" <linux-input@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        chiminghao <chi.minghao@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] drivers:hid: use swap() to make code cleaner

Hi,

On Tue, Nov 9, 2021 at 9:26 AM <cgel.zte@...il.com> wrote:
>
> From: chiminghao <chi.minghao@....com.cn>
>
> Fix the following coccicheck REVIEW:
> Use swap() instead of reimplementing it.
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: chiminghao <chi.minghao@....com.cn>
> ---

Amended the commit title to match what we do generally in the HID tree
and applied to for-5.17/thrustmaster.

Thanks for the patch!

Cheers,
Benjamin

>  drivers/hid/hid-tmff.c | 8 ++------
>  1 file 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;
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ