diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-03-14 00:09:16 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-14 00:09:16 -0500 |
commit | b39787a972042ded183343b177d9c595b5704575 (patch) | |
tree | ff0336c45ff4f8bbb3e64af5cc16bcfe75fbb54b /drivers/input | |
parent | 493a7e0d5614c30e1f3e56d59ab774300a2609f2 (diff) |
Input: use kzalloc() throughout the code
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/evbug.c | 3 | ||||
-rw-r--r-- | drivers/input/evdev.c | 6 | ||||
-rw-r--r-- | drivers/input/joydev.c | 6 | ||||
-rw-r--r-- | drivers/input/keyboard/hil_kbd.c | 3 | ||||
-rw-r--r-- | drivers/input/mouse/hil_ptr.c | 7 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 7 | ||||
-rw-r--r-- | drivers/input/mousedev.c | 6 | ||||
-rw-r--r-- | drivers/input/power.c | 3 | ||||
-rw-r--r-- | drivers/input/serio/hil_mlc.c | 3 | ||||
-rw-r--r-- | drivers/input/serio/parkbd.c | 3 | ||||
-rw-r--r-- | drivers/input/serio/rpckbd.c | 3 | ||||
-rw-r--r-- | drivers/input/serio/serio_raw.c | 6 | ||||
-rw-r--r-- | drivers/input/tsdev.c | 6 |
13 files changed, 22 insertions, 40 deletions
diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c index d7828936fd8f..07358fb51b82 100644 --- a/drivers/input/evbug.c +++ b/drivers/input/evbug.c | |||
@@ -49,9 +49,8 @@ static struct input_handle *evbug_connect(struct input_handler *handler, struct | |||
49 | { | 49 | { |
50 | struct input_handle *handle; | 50 | struct input_handle *handle; |
51 | 51 | ||
52 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | 52 | if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) |
53 | return NULL; | 53 | return NULL; |
54 | memset(handle, 0, sizeof(struct input_handle)); | ||
55 | 54 | ||
56 | handle->dev = dev; | 55 | handle->dev = dev; |
57 | handle->handler = handler; | 56 | handle->handler = handler; |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 745979f33dc2..a34e3d91d9ed 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -130,9 +130,8 @@ static int evdev_open(struct inode * inode, struct file * file) | |||
130 | if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) | 130 | if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) |
131 | return accept_err; | 131 | return accept_err; |
132 | 132 | ||
133 | if (!(list = kmalloc(sizeof(struct evdev_list), GFP_KERNEL))) | 133 | if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) |
134 | return -ENOMEM; | 134 | return -ENOMEM; |
135 | memset(list, 0, sizeof(struct evdev_list)); | ||
136 | 135 | ||
137 | list->evdev = evdev_table[i]; | 136 | list->evdev = evdev_table[i]; |
138 | list_add_tail(&list->node, &evdev_table[i]->list); | 137 | list_add_tail(&list->node, &evdev_table[i]->list); |
@@ -609,9 +608,8 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct | |||
609 | return NULL; | 608 | return NULL; |
610 | } | 609 | } |
611 | 610 | ||
612 | if (!(evdev = kmalloc(sizeof(struct evdev), GFP_KERNEL))) | 611 | if (!(evdev = kzalloc(sizeof(struct evdev), GFP_KERNEL))) |
613 | return NULL; | 612 | return NULL; |
614 | memset(evdev, 0, sizeof(struct evdev)); | ||
615 | 613 | ||
616 | INIT_LIST_HEAD(&evdev->list); | 614 | INIT_LIST_HEAD(&evdev->list); |
617 | init_waitqueue_head(&evdev->wait); | 615 | init_waitqueue_head(&evdev->wait); |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 20e2972b9204..949bdcef8c2b 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -171,9 +171,8 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
171 | if (i >= JOYDEV_MINORS || !joydev_table[i]) | 171 | if (i >= JOYDEV_MINORS || !joydev_table[i]) |
172 | return -ENODEV; | 172 | return -ENODEV; |
173 | 173 | ||
174 | if (!(list = kmalloc(sizeof(struct joydev_list), GFP_KERNEL))) | 174 | if (!(list = kzalloc(sizeof(struct joydev_list), GFP_KERNEL))) |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
176 | memset(list, 0, sizeof(struct joydev_list)); | ||
177 | 176 | ||
178 | list->joydev = joydev_table[i]; | 177 | list->joydev = joydev_table[i]; |
179 | list_add_tail(&list->node, &joydev_table[i]->list); | 178 | list_add_tail(&list->node, &joydev_table[i]->list); |
@@ -457,9 +456,8 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct | |||
457 | return NULL; | 456 | return NULL; |
458 | } | 457 | } |
459 | 458 | ||
460 | if (!(joydev = kmalloc(sizeof(struct joydev), GFP_KERNEL))) | 459 | if (!(joydev = kzalloc(sizeof(struct joydev), GFP_KERNEL))) |
461 | return NULL; | 460 | return NULL; |
462 | memset(joydev, 0, sizeof(struct joydev)); | ||
463 | 461 | ||
464 | INIT_LIST_HEAD(&joydev->list); | 462 | INIT_LIST_HEAD(&joydev->list); |
465 | init_waitqueue_head(&joydev->wait); | 463 | init_waitqueue_head(&joydev->wait); |
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c index 0a90962c38e7..ed3271b71400 100644 --- a/drivers/input/keyboard/hil_kbd.c +++ b/drivers/input/keyboard/hil_kbd.c | |||
@@ -251,10 +251,9 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) | |||
251 | uint8_t did, *idd; | 251 | uint8_t did, *idd; |
252 | int i; | 252 | int i; |
253 | 253 | ||
254 | kbd = kmalloc(sizeof(*kbd), GFP_KERNEL); | 254 | kbd = kzalloc(sizeof(*kbd), GFP_KERNEL); |
255 | if (!kbd) | 255 | if (!kbd) |
256 | return -ENOMEM; | 256 | return -ENOMEM; |
257 | memset(kbd, 0, sizeof(struct hil_kbd)); | ||
258 | 257 | ||
259 | if (serio_open(serio, drv)) goto bail0; | 258 | if (serio_open(serio, drv)) goto bail0; |
260 | 259 | ||
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c index c2bf2ed07dc6..798f4a3ad7d2 100644 --- a/drivers/input/mouse/hil_ptr.c +++ b/drivers/input/mouse/hil_ptr.c | |||
@@ -245,10 +245,11 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) | |||
245 | unsigned int i, naxsets, btntype; | 245 | unsigned int i, naxsets, btntype; |
246 | uint8_t did, *idd; | 246 | uint8_t did, *idd; |
247 | 247 | ||
248 | if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return -ENOMEM; | 248 | if (!(ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL))) |
249 | memset(ptr, 0, sizeof(struct hil_ptr)); | 249 | return -ENOMEM; |
250 | 250 | ||
251 | if (serio_open(serio, driver)) goto bail0; | 251 | if (serio_open(serio, driver)) |
252 | goto bail0; | ||
252 | 253 | ||
253 | serio_set_drvdata(serio, ptr); | 254 | serio_set_drvdata(serio, ptr); |
254 | ptr->serio = serio; | 255 | ptr->serio = serio; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 2051bec2c394..d27d52c3c656 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -247,14 +247,12 @@ static void synaptics_pt_create(struct psmouse *psmouse) | |||
247 | { | 247 | { |
248 | struct serio *serio; | 248 | struct serio *serio; |
249 | 249 | ||
250 | serio = kmalloc(sizeof(struct serio), GFP_KERNEL); | 250 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
251 | if (!serio) { | 251 | if (!serio) { |
252 | printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); | 252 | printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | 255 | ||
256 | memset(serio, 0, sizeof(struct serio)); | ||
257 | |||
258 | serio->id.type = SERIO_PS_PSTHRU; | 256 | serio->id.type = SERIO_PS_PSTHRU; |
259 | strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); | 257 | strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); |
260 | strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); | 258 | strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); |
@@ -623,10 +621,9 @@ int synaptics_init(struct psmouse *psmouse) | |||
623 | { | 621 | { |
624 | struct synaptics_data *priv; | 622 | struct synaptics_data *priv; |
625 | 623 | ||
626 | psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); | 624 | psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL); |
627 | if (!priv) | 625 | if (!priv) |
628 | return -1; | 626 | return -1; |
629 | memset(priv, 0, sizeof(struct synaptics_data)); | ||
630 | 627 | ||
631 | if (synaptics_query_hardware(psmouse)) { | 628 | if (synaptics_query_hardware(psmouse)) { |
632 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); | 629 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 9abed18d2ecf..b685a507955d 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -412,9 +412,8 @@ static int mousedev_open(struct inode * inode, struct file * file) | |||
412 | if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) | 412 | if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) |
413 | return -ENODEV; | 413 | return -ENODEV; |
414 | 414 | ||
415 | if (!(list = kmalloc(sizeof(struct mousedev_list), GFP_KERNEL))) | 415 | if (!(list = kzalloc(sizeof(struct mousedev_list), GFP_KERNEL))) |
416 | return -ENOMEM; | 416 | return -ENOMEM; |
417 | memset(list, 0, sizeof(struct mousedev_list)); | ||
418 | 417 | ||
419 | spin_lock_init(&list->packet_lock); | 418 | spin_lock_init(&list->packet_lock); |
420 | list->pos_x = xres / 2; | 419 | list->pos_x = xres / 2; |
@@ -626,9 +625,8 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru | |||
626 | return NULL; | 625 | return NULL; |
627 | } | 626 | } |
628 | 627 | ||
629 | if (!(mousedev = kmalloc(sizeof(struct mousedev), GFP_KERNEL))) | 628 | if (!(mousedev = kzalloc(sizeof(struct mousedev), GFP_KERNEL))) |
630 | return NULL; | 629 | return NULL; |
631 | memset(mousedev, 0, sizeof(struct mousedev)); | ||
632 | 630 | ||
633 | INIT_LIST_HEAD(&mousedev->list); | 631 | INIT_LIST_HEAD(&mousedev->list); |
634 | init_waitqueue_head(&mousedev->wait); | 632 | init_waitqueue_head(&mousedev->wait); |
diff --git a/drivers/input/power.c b/drivers/input/power.c index bfc5c63ebffe..526e6070600c 100644 --- a/drivers/input/power.c +++ b/drivers/input/power.c | |||
@@ -103,9 +103,8 @@ static struct input_handle *power_connect(struct input_handler *handler, | |||
103 | { | 103 | { |
104 | struct input_handle *handle; | 104 | struct input_handle *handle; |
105 | 105 | ||
106 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | 106 | if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) |
107 | return NULL; | 107 | return NULL; |
108 | memset(handle, 0, sizeof(struct input_handle)); | ||
109 | 108 | ||
110 | handle->dev = dev; | 109 | handle->dev = dev; |
111 | handle->handler = handler; | 110 | handle->handler = handler; |
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index 5704204964a3..73aa8df84bcd 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c | |||
@@ -872,9 +872,8 @@ int hil_mlc_register(hil_mlc *mlc) { | |||
872 | for (i = 0; i < HIL_MLC_DEVMEM; i++) { | 872 | for (i = 0; i < HIL_MLC_DEVMEM; i++) { |
873 | struct serio *mlc_serio; | 873 | struct serio *mlc_serio; |
874 | hil_mlc_copy_di_scratch(mlc, i); | 874 | hil_mlc_copy_di_scratch(mlc, i); |
875 | mlc_serio = kmalloc(sizeof(*mlc_serio), GFP_KERNEL); | 875 | mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL); |
876 | mlc->serio[i] = mlc_serio; | 876 | mlc->serio[i] = mlc_serio; |
877 | memset(mlc_serio, 0, sizeof(*mlc_serio)); | ||
878 | mlc_serio->id = hil_mlc_serio_id; | 877 | mlc_serio->id = hil_mlc_serio_id; |
879 | mlc_serio->write = hil_mlc_serio_write; | 878 | mlc_serio->write = hil_mlc_serio_write; |
880 | mlc_serio->open = hil_mlc_serio_open; | 879 | mlc_serio->open = hil_mlc_serio_open; |
diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c index 1d15c2819818..a5c1fb3a4a51 100644 --- a/drivers/input/serio/parkbd.c +++ b/drivers/input/serio/parkbd.c | |||
@@ -171,9 +171,8 @@ static struct serio * __init parkbd_allocate_serio(void) | |||
171 | { | 171 | { |
172 | struct serio *serio; | 172 | struct serio *serio; |
173 | 173 | ||
174 | serio = kmalloc(sizeof(struct serio), GFP_KERNEL); | 174 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
175 | if (serio) { | 175 | if (serio) { |
176 | memset(serio, 0, sizeof(struct serio)); | ||
177 | serio->id.type = parkbd_mode; | 176 | serio->id.type = parkbd_mode; |
178 | serio->write = parkbd_write, | 177 | serio->write = parkbd_write, |
179 | strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); | 178 | strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); |
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index a3bd11589bc3..513d37fc1acf 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c | |||
@@ -111,11 +111,10 @@ static int __devinit rpckbd_probe(struct platform_device *dev) | |||
111 | { | 111 | { |
112 | struct serio *serio; | 112 | struct serio *serio; |
113 | 113 | ||
114 | serio = kmalloc(sizeof(struct serio), GFP_KERNEL); | 114 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
115 | if (!serio) | 115 | if (!serio) |
116 | return -ENOMEM; | 116 | return -ENOMEM; |
117 | 117 | ||
118 | memset(serio, 0, sizeof(struct serio)); | ||
119 | serio->id.type = SERIO_8042; | 118 | serio->id.type = SERIO_8042; |
120 | serio->write = rpckbd_write; | 119 | serio->write = rpckbd_write; |
121 | serio->open = rpckbd_open; | 120 | serio->open = rpckbd_open; |
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 8734e7f75b7d..5a2703b536dc 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -96,12 +96,11 @@ static int serio_raw_open(struct inode *inode, struct file *file) | |||
96 | goto out; | 96 | goto out; |
97 | } | 97 | } |
98 | 98 | ||
99 | if (!(list = kmalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { | 99 | if (!(list = kzalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { |
100 | retval = -ENOMEM; | 100 | retval = -ENOMEM; |
101 | goto out; | 101 | goto out; |
102 | } | 102 | } |
103 | 103 | ||
104 | memset(list, 0, sizeof(struct serio_raw_list)); | ||
105 | list->serio_raw = serio_raw; | 104 | list->serio_raw = serio_raw; |
106 | file->private_data = list; | 105 | file->private_data = list; |
107 | 106 | ||
@@ -276,14 +275,13 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) | |||
276 | struct serio_raw *serio_raw; | 275 | struct serio_raw *serio_raw; |
277 | int err; | 276 | int err; |
278 | 277 | ||
279 | if (!(serio_raw = kmalloc(sizeof(struct serio_raw), GFP_KERNEL))) { | 278 | if (!(serio_raw = kzalloc(sizeof(struct serio_raw), GFP_KERNEL))) { |
280 | printk(KERN_ERR "serio_raw.c: can't allocate memory for a device\n"); | 279 | printk(KERN_ERR "serio_raw.c: can't allocate memory for a device\n"); |
281 | return -ENOMEM; | 280 | return -ENOMEM; |
282 | } | 281 | } |
283 | 282 | ||
284 | mutex_lock(&serio_raw_mutex); | 283 | mutex_lock(&serio_raw_mutex); |
285 | 284 | ||
286 | memset(serio_raw, 0, sizeof(struct serio_raw)); | ||
287 | snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); | 285 | snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); |
288 | serio_raw->refcnt = 1; | 286 | serio_raw->refcnt = 1; |
289 | serio_raw->serio = serio; | 287 | serio_raw->serio = serio; |
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index ca1547929d62..d678d144bbf8 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c | |||
@@ -157,9 +157,8 @@ static int tsdev_open(struct inode *inode, struct file *file) | |||
157 | if (i >= TSDEV_MINORS || !tsdev_table[i & TSDEV_MINOR_MASK]) | 157 | if (i >= TSDEV_MINORS || !tsdev_table[i & TSDEV_MINOR_MASK]) |
158 | return -ENODEV; | 158 | return -ENODEV; |
159 | 159 | ||
160 | if (!(list = kmalloc(sizeof(struct tsdev_list), GFP_KERNEL))) | 160 | if (!(list = kzalloc(sizeof(struct tsdev_list), GFP_KERNEL))) |
161 | return -ENOMEM; | 161 | return -ENOMEM; |
162 | memset(list, 0, sizeof(struct tsdev_list)); | ||
163 | 162 | ||
164 | list->raw = (i >= TSDEV_MINORS/2) ? 1 : 0; | 163 | list->raw = (i >= TSDEV_MINORS/2) ? 1 : 0; |
165 | 164 | ||
@@ -379,9 +378,8 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
379 | return NULL; | 378 | return NULL; |
380 | } | 379 | } |
381 | 380 | ||
382 | if (!(tsdev = kmalloc(sizeof(struct tsdev), GFP_KERNEL))) | 381 | if (!(tsdev = kzalloc(sizeof(struct tsdev), GFP_KERNEL))) |
383 | return NULL; | 382 | return NULL; |
384 | memset(tsdev, 0, sizeof(struct tsdev)); | ||
385 | 383 | ||
386 | INIT_LIST_HEAD(&tsdev->list); | 384 | INIT_LIST_HEAD(&tsdev->list); |
387 | init_waitqueue_head(&tsdev->wait); | 385 | init_waitqueue_head(&tsdev->wait); |