linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Hui Wang <hui.wang@canonical.com>
Cc: linux-input@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] Input: alps - Fix a mismatch between a condition check and its comment
Date: Fri, 19 Jul 2019 12:39:53 +0300	[thread overview]
Message-ID: <20190719093953.GA904@penguin> (raw)
In-Reply-To: <20190719090135.17811-1-hui.wang@canonical.com>

On Fri, Jul 19, 2019 at 05:01:35PM +0800, Hui Wang wrote:
> In the function alps_is_cs19_trackpoint(), we check if the param[1] is
> in the 0x20~0x2f range, but the code we wrote for this checking is not
> correct:
> (param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f,
> it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f...
> 
> Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20).
> 
> Fixes: 7e4935ccc323 ("Input: alps - don't handle ALPS cs19 trackpoint-only device")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Wang <hui.wang@canonical.com>

Applied, thank you.

> ---
>  drivers/input/mouse/alps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 62ffea00902a..34700eda0429 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -2876,7 +2876,7 @@ static bool alps_is_cs19_trackpoint(struct psmouse *psmouse)
>  	 * trackpoint-only devices have their variant_ids equal
>  	 * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range.
>  	 */
> -	return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20);
> +	return param[0] == TP_VARIANT_ALPS && ((param[1] & 0xf0) == 0x20);
>  }
>  
>  static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
> -- 
> 2.17.1
> 

-- 
Dmitry

      reply	other threads:[~2019-07-19  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19  9:01 [PATCH] Input: alps - Fix a mismatch between a condition check and its comment Hui Wang
2019-07-19  9:39 ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190719093953.GA904@penguin \
    --to=dmitry.torokhov@gmail.com \
    --cc=hui.wang@canonical.com \
    --cc=linux-input@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).