linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: Avoid kernel panic during device unregistration
@ 2014-12-28 18:12 Aniroop Mathur
  2014-12-28 20:21 ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Aniroop Mathur @ 2014-12-28 18:12 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input; +Cc: aniroop.mathur, a.mathur

This patch adds null check before actually unregistering the input device
to avoid null pointer exception which leads to kernel panic.

So now, input device drivers won't have to worry about or add null case
condition before calling input_unregister_device() in shutdown and
remove functions.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
---
 drivers/input/input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 01fe49e..575219d 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2170,6 +2170,9 @@ EXPORT_SYMBOL(input_register_device);
  */
 void input_unregister_device(struct input_dev *dev)
 {
+	if (!dev)
+		return;
+
 	if (dev->devres_managed) {
 		WARN_ON(devres_destroy(dev->dev.parent,
 					devm_input_device_unregister,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-29 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-28 18:12 [PATCH] Input: Avoid kernel panic during device unregistration Aniroop Mathur
2014-12-28 20:21 ` Dmitry Torokhov
2014-12-29 16:41   ` Aniroop Mathur
2014-12-29 17:23     ` Dmitry Torokhov
2014-12-29 17:38       ` Aniroop Mathur

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).