浏览代码

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>
Dmitry Torokhov 19 年之前
父节点
当前提交
1a0ccece05
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      include/linux/input.h

+ 2 - 1
include/linux/input.h

@@ -1016,7 +1016,8 @@ static inline void input_put_device(struct input_dev *dev)
 
 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 *);