aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdn_ppp.c
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/isdn_ppp.c
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/isdn_ppp.c')
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c14
1 files changed, 4 insertions, 10 deletions
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;