Thread (4 messages) 4 messages, 3 authors, 2011-12-30

[PATCH] only assign psmouse handlers on successful return from fsp_init()

flat view
STALE5398d

From: Paul Fox <hidden>
Date: 2011-12-28 20:18:43
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

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 <redacted>

---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help