linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Fox <pgf@laptop.org>
To: linux-input@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Tai-hwa Liang <avatar@sentelic.com>
Subject: [PATCH] only assign psmouse handlers on successful return from fsp_init()
Date: Wed, 28 Dec 2011 15:11:46 -0500	[thread overview]
Message-ID: <2424.1325103106@foxharp.boston.ma.us> (raw)

the psmouse action routines were being initialized before all
possible error conditions had been considered.  a subsequent
failure would leave these handlers set, and later touchpad
traffic or psmouse driver actions could cause them to be called,
even though fsp_init() had failed.

Signed-off-by: Paul Fox <pgf@laptop.org>

---
 drivers/input/mouse/sentelic.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 2fc887a..3539ca6 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -842,12 +842,6 @@ int fsp_init(struct psmouse *psmouse)
 	__set_bit(REL_WHEEL, psmouse->dev->relbit);
 	__set_bit(REL_HWHEEL, psmouse->dev->relbit);
 
-	psmouse->protocol_handler = fsp_process_byte;
-	psmouse->disconnect = fsp_disconnect;
-	psmouse->reconnect = fsp_reconnect;
-	psmouse->cleanup = fsp_reset;
-	psmouse->pktsize = 4;
-
 	/* set default packet output based on number of buttons we found */
 	error = fsp_activate_protocol(psmouse);
 	if (error)
@@ -861,6 +855,12 @@ int fsp_init(struct psmouse *psmouse)
 		goto err_out;
 	}
 
+	psmouse->protocol_handler = fsp_process_byte;
+	psmouse->disconnect = fsp_disconnect;
+	psmouse->reconnect = fsp_reconnect;
+	psmouse->cleanup = fsp_reset;
+	psmouse->pktsize = 4;
+
 	return 0;
 
  err_out:
-- 
1.7.1



=---------------------
 paul fox, pgf@laptop.org

             reply	other threads:[~2011-12-28 20:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 20:11 Paul Fox [this message]
2011-12-29  1:40 ` [PATCH] only assign psmouse handlers on successful return from fsp_init() Tai-hwa Liang
2011-12-30  8:23   ` Dmitry Torokhov
2011-12-30 10:36     ` Tai-hwa Liang
2011-12-30 14:46     ` Paul Fox

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=2424.1325103106@foxharp.boston.ma.us \
    --to=pgf@laptop.org \
    --cc=avatar@sentelic.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@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).