All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aniroop Mathur <a.mathur@samsung.com>
To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: aniroop.mathur@gmail.com, a.mathur@samsung.com
Subject: [PATCH] Evdev: Fix bug of comparing clk_type with clkid
Date: Thu, 29 Oct 2015 01:13:36 +0530	[thread overview]
Message-ID: <1446061416-9066-1-git-send-email-aniroop.mathur@gmail.com> (raw)

From: Aniroop Mathur <a.mathur@samsung.com>

clk_type and clkid stores different predefined clock identification
values so they cannot be compared.
Therefore, lets fix it to avoid unexpected results.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com>
---
 drivers/input/evdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 08d4964..0d40f6f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -56,7 +56,7 @@ struct evdev_client {
 	struct fasync_struct *fasync;
 	struct evdev *evdev;
 	struct list_head node;
-	int clk_type;
+	unsigned int clk_type;
 	bool revoked;
 	unsigned int bufsize;
 	struct input_event buffer[];
@@ -146,9 +146,7 @@ static void evdev_queue_syn_dropped(struct evdev_client *client)
 static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 {
 	unsigned long flags;
-
-	if (client->clk_type == clkid)
-		return 0;
+	unsigned int prev_clk_type = client->clk_type;
 
 	switch (clkid) {
 
@@ -165,6 +163,10 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 		return -EINVAL;
 	}
 
+	/* No need to flush if clk_type is same as before */
+	if (client->clk_type == prev_clk_type)
+		return 0;
+
 	/*
 	 * Flush pending events and queue SYN_DROPPED event,
 	 * but only if the queue is not empty.
-- 
2.6.2


                 reply	other threads:[~2015-10-28 19:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1446061416-9066-1-git-send-email-aniroop.mathur@gmail.com \
    --to=a.mathur@samsung.com \
    --cc=aniroop.mathur@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.