aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l
diff options
context:
space:
mode:
authorBurman Yan <yan_952@hotmail.com>2006-12-08 05:39:35 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:29:01 -0500
commit41f96935b4c41daea2c4dbbf137960375cf764c1 (patch)
tree9af3af5e41f68baf063b5f929797c837169bb9df /drivers/isdn/i4l
parent0b2dd130a5a8774a30de1f94266f6b9a9892153c (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/i4l')
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c4
-rw-r--r--drivers/isdn/i4l/isdn_common.c9
-rw-r--r--drivers/isdn/i4l/isdn_net.c6
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c14
-rw-r--r--drivers/isdn/i4l/isdn_v110.c3
5 files changed, 11 insertions, 25 deletions
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index 0afe442db3b0..a20f33b4a220 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -331,12 +331,10 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
331 * Allocate the main control structure for this instance. 331 * Allocate the main control structure for this instance.
332 */ 332 */
333 maxmaxcode = MAXCODE(bits); 333 maxmaxcode = MAXCODE(bits);
334 db = (struct bsd_db *) kmalloc (sizeof (struct bsd_db),GFP_KERNEL); 334 db = kzalloc (sizeof (struct bsd_db),GFP_KERNEL);
335 if (!db) 335 if (!db)
336 return NULL; 336 return NULL;
337 337
338 memset (db, 0, sizeof(struct bsd_db));
339
340 db->xmit = data->flags & IPPP_COMP_FLAG_XMIT; 338 db->xmit = data->flags & IPPP_COMP_FLAG_XMIT;
341 decomp = db->xmit ? 0 : 1; 339 decomp = db->xmit ? 0 : 1;
342 340
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index a610a05aa217..6a2ef0a87ed9 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -2072,21 +2072,19 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
2072 2072
2073 if ((adding) && (d->rcverr)) 2073 if ((adding) && (d->rcverr))
2074 kfree(d->rcverr); 2074 kfree(d->rcverr);
2075 if (!(d->rcverr = kmalloc(sizeof(int) * m, GFP_ATOMIC))) { 2075 if (!(d->rcverr = kzalloc(sizeof(int) * m, GFP_ATOMIC))) {
2076 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); 2076 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n");
2077 return -1; 2077 return -1;
2078 } 2078 }
2079 memset((char *) d->rcverr, 0, sizeof(int) * m);
2080 2079
2081 if ((adding) && (d->rcvcount)) 2080 if ((adding) && (d->rcvcount))
2082 kfree(d->rcvcount); 2081 kfree(d->rcvcount);
2083 if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) { 2082 if (!(d->rcvcount = kzalloc(sizeof(int) * m, GFP_ATOMIC))) {
2084 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); 2083 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
2085 if (!adding) 2084 if (!adding)
2086 kfree(d->rcverr); 2085 kfree(d->rcverr);
2087 return -1; 2086 return -1;
2088 } 2087 }
2089 memset((char *) d->rcvcount, 0, sizeof(int) * m);
2090 2088
2091 if ((adding) && (d->rpqueue)) { 2089 if ((adding) && (d->rpqueue)) {
2092 for (j = 0; j < d->channels; j++) 2090 for (j = 0; j < d->channels; j++)
@@ -2226,11 +2224,10 @@ register_isdn(isdn_if * i)
2226 printk(KERN_WARNING "register_isdn: No write routine given.\n"); 2224 printk(KERN_WARNING "register_isdn: No write routine given.\n");
2227 return 0; 2225 return 0;
2228 } 2226 }
2229 if (!(d = kmalloc(sizeof(isdn_driver_t), GFP_KERNEL))) { 2227 if (!(d = kzalloc(sizeof(isdn_driver_t), GFP_KERNEL))) {
2230 printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); 2228 printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n");
2231 return 0; 2229 return 0;
2232 } 2230 }
2233 memset((char *) d, 0, sizeof(isdn_driver_t));
2234 2231
2235 d->maxbufsize = i->maxbufsize; 2232 d->maxbufsize = i->maxbufsize;
2236 d->pktcount = 0; 2233 d->pktcount = 0;
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 2e4daebfb7e0..c36c817578cb 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2542,17 +2542,15 @@ isdn_net_new(char *name, struct net_device *master)
2542 printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); 2542 printk(KERN_WARNING "isdn_net: interface %s already exists\n", name);
2543 return NULL; 2543 return NULL;
2544 } 2544 }
2545 if (!(netdev = (isdn_net_dev *) kmalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { 2545 if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) {
2546 printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); 2546 printk(KERN_WARNING "isdn_net: Could not allocate net-device\n");
2547 return NULL; 2547 return NULL;
2548 } 2548 }
2549 memset(netdev, 0, sizeof(isdn_net_dev)); 2549 if (!(netdev->local = kzalloc(sizeof(isdn_net_local), GFP_KERNEL))) {
2550 if (!(netdev->local = (isdn_net_local *) kmalloc(sizeof(isdn_net_local), GFP_KERNEL))) {
2551 printk(KERN_WARNING "isdn_net: Could not allocate device locals\n"); 2550 printk(KERN_WARNING "isdn_net: Could not allocate device locals\n");
2552 kfree(netdev); 2551 kfree(netdev);
2553 return NULL; 2552 return NULL;
2554 } 2553 }
2555 memset(netdev->local, 0, sizeof(isdn_net_local));
2556 if (name == NULL) 2554 if (name == NULL)
2557 strcpy(netdev->local->name, " "); 2555 strcpy(netdev->local->name, " ");
2558 else 2556 else
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 26e46720fc1c..43811795b46b 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -876,14 +876,12 @@ isdn_ppp_init(void)
876#endif /* CONFIG_ISDN_MPP */ 876#endif /* CONFIG_ISDN_MPP */
877 877
878 for (i = 0; i < ISDN_MAX_CHANNELS; i++) { 878 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
879 if (!(ippp_table[i] = (struct ippp_struct *) 879 if (!(ippp_table[i] = kzalloc(sizeof(struct ippp_struct), GFP_KERNEL))) {
880 kmalloc(sizeof(struct ippp_struct), GFP_KERNEL))) {
881 printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n"); 880 printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n");
882 for (j = 0; j < i; j++) 881 for (j = 0; j < i; j++)
883 kfree(ippp_table[j]); 882 kfree(ippp_table[j]);
884 return -1; 883 return -1;
885 } 884 }
886 memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct));
887 spin_lock_init(&ippp_table[i]->buflock); 885 spin_lock_init(&ippp_table[i]->buflock);
888 ippp_table[i]->state = 0; 886 ippp_table[i]->state = 0;
889 ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1; 887 ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1;
@@ -1529,10 +1527,8 @@ static int isdn_ppp_mp_bundle_array_init(void)
1529{ 1527{
1530 int i; 1528 int i;
1531 int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); 1529 int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle);
1532 if( (isdn_ppp_bundle_arr = (ippp_bundle*)kmalloc(sz, 1530 if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL )
1533 GFP_KERNEL)) == NULL )
1534 return -ENOMEM; 1531 return -ENOMEM;
1535 memset(isdn_ppp_bundle_arr, 0, sz);
1536 for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) 1532 for( i = 0; i < ISDN_MAX_CHANNELS; i++ )
1537 spin_lock_init(&isdn_ppp_bundle_arr[i].lock); 1533 spin_lock_init(&isdn_ppp_bundle_arr[i].lock);
1538 return 0; 1534 return 0;
@@ -2246,13 +2242,12 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
2246static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is) 2242static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is)
2247{ 2243{
2248 struct ippp_ccp_reset *r; 2244 struct ippp_ccp_reset *r;
2249 r = kmalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL); 2245 r = kzalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL);
2250 if(!r) { 2246 if(!r) {
2251 printk(KERN_ERR "ippp_ccp: failed to allocate reset data" 2247 printk(KERN_ERR "ippp_ccp: failed to allocate reset data"
2252 " structure - no mem\n"); 2248 " structure - no mem\n");
2253 return NULL; 2249 return NULL;
2254 } 2250 }
2255 memset(r, 0, sizeof(struct ippp_ccp_reset));
2256 printk(KERN_DEBUG "ippp_ccp: allocated reset data structure %p\n", r); 2251 printk(KERN_DEBUG "ippp_ccp: allocated reset data structure %p\n", r);
2257 is->reset = r; 2252 is->reset = r;
2258 return r; 2253 return r;
@@ -2338,10 +2333,9 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s
2338 id); 2333 id);
2339 return NULL; 2334 return NULL;
2340 } else { 2335 } else {
2341 rs = kmalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); 2336 rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL);
2342 if(!rs) 2337 if(!rs)
2343 return NULL; 2338 return NULL;
2344 memset(rs, 0, sizeof(struct ippp_ccp_reset_state));
2345 rs->state = CCPResetIdle; 2339 rs->state = CCPResetIdle;
2346 rs->is = is; 2340 rs->is = is;
2347 rs->id = id; 2341 rs->id = id;
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c
index 38619e8cd823..5484d3c38a57 100644
--- a/drivers/isdn/i4l/isdn_v110.c
+++ b/drivers/isdn/i4l/isdn_v110.c
@@ -92,9 +92,8 @@ isdn_v110_open(unsigned char key, int hdrlen, int maxsize)
92 int i; 92 int i;
93 isdn_v110_stream *v; 93 isdn_v110_stream *v;
94 94
95 if ((v = kmalloc(sizeof(isdn_v110_stream), GFP_ATOMIC)) == NULL) 95 if ((v = kzalloc(sizeof(isdn_v110_stream), GFP_ATOMIC)) == NULL)
96 return NULL; 96 return NULL;
97 memset(v, 0, sizeof(isdn_v110_stream));
98 v->key = key; 97 v->key = key;
99 v->nbits = 0; 98 v->nbits = 0;
100 for (i = 0; key & (1 << i); i++) 99 for (i = 0; key & (1 << i); i++)