diff options
author | Burman Yan <yan_952@hotmail.com> | 2006-12-08 05:39:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:01 -0500 |
commit | 41f96935b4c41daea2c4dbbf137960375cf764c1 (patch) | |
tree | 9af3af5e41f68baf063b5f929797c837169bb9df /drivers/isdn/pcbit | |
parent | 0b2dd130a5a8774a30de1f94266f6b9a9892153c (diff) |
[PATCH] isdn: replace kmalloc+memset with kzalloc
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/pcbit')
-rw-r--r-- | drivers/isdn/pcbit/drv.c | 9 | ||||
-rw-r--r-- | drivers/isdn/pcbit/layer2.c | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 1966f3410a13..11c1b0b6e390 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c | |||
@@ -73,14 +73,13 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
73 | struct pcbit_dev *dev; | 73 | struct pcbit_dev *dev; |
74 | isdn_if *dev_if; | 74 | isdn_if *dev_if; |
75 | 75 | ||
76 | if ((dev=kmalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) | 76 | if ((dev=kzalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) |
77 | { | 77 | { |
78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); | 78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); |
79 | return -ENOMEM; | 79 | return -ENOMEM; |
80 | } | 80 | } |
81 | 81 | ||
82 | dev_pcbit[board] = dev; | 82 | dev_pcbit[board] = dev; |
83 | memset(dev, 0, sizeof(struct pcbit_dev)); | ||
84 | init_waitqueue_head(&dev->set_running_wq); | 83 | init_waitqueue_head(&dev->set_running_wq); |
85 | spin_lock_init(&dev->lock); | 84 | spin_lock_init(&dev->lock); |
86 | 85 | ||
@@ -104,7 +103,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
104 | return -EACCES; | 103 | return -EACCES; |
105 | } | 104 | } |
106 | 105 | ||
107 | dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); | 106 | dev->b1 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); |
108 | if (!dev->b1) { | 107 | if (!dev->b1) { |
109 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); | 108 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); |
110 | iounmap(dev->sh_mem); | 109 | iounmap(dev->sh_mem); |
@@ -113,7 +112,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
113 | return -ENOMEM; | 112 | return -ENOMEM; |
114 | } | 113 | } |
115 | 114 | ||
116 | dev->b2 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); | 115 | dev->b2 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); |
117 | if (!dev->b2) { | 116 | if (!dev->b2) { |
118 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); | 117 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); |
119 | kfree(dev->b1); | 118 | kfree(dev->b1); |
@@ -123,8 +122,6 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
123 | return -ENOMEM; | 122 | return -ENOMEM; |
124 | } | 123 | } |
125 | 124 | ||
126 | memset(dev->b1, 0, sizeof(struct pcbit_chan)); | ||
127 | memset(dev->b2, 0, sizeof(struct pcbit_chan)); | ||
128 | dev->b2->id = 1; | 125 | dev->b2->id = 1; |
129 | 126 | ||
130 | INIT_WORK(&dev->qdelivery, pcbit_deliver); | 127 | INIT_WORK(&dev->qdelivery, pcbit_deliver); |
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c index 0c9f6df873fc..6ff85574e941 100644 --- a/drivers/isdn/pcbit/layer2.c +++ b/drivers/isdn/pcbit/layer2.c | |||
@@ -369,13 +369,12 @@ pcbit_receive(struct pcbit_dev *dev) | |||
369 | kfree(dev->read_frame); | 369 | kfree(dev->read_frame); |
370 | dev->read_frame = NULL; | 370 | dev->read_frame = NULL; |
371 | } | 371 | } |
372 | frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC); | 372 | frame = kzalloc(sizeof(struct frame_buf), GFP_ATOMIC); |
373 | 373 | ||
374 | if (frame == NULL) { | 374 | if (frame == NULL) { |
375 | printk(KERN_WARNING "kmalloc failed\n"); | 375 | printk(KERN_WARNING "kmalloc failed\n"); |
376 | return; | 376 | return; |
377 | } | 377 | } |
378 | memset(frame, 0, sizeof(struct frame_buf)); | ||
379 | 378 | ||
380 | cpu = pcbit_readb(dev); | 379 | cpu = pcbit_readb(dev); |
381 | proc = pcbit_readb(dev); | 380 | proc = pcbit_readb(dev); |