Input: allow passing NULL to input_free_device()

Many drivers rely on input_free_device() behaving like kfree().

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/include/linux/input.h b/include/linux/input.h
index b0e612d..16c19d71 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1016,7 +1016,8 @@
 
 static inline void input_free_device(struct input_dev *dev)
 {
-	input_put_device(dev);
+	if (dev)
+		input_put_device(dev);
 }
 
 int input_register_device(struct input_dev *);