diff options
Diffstat (limited to 'net/irda/irttp.c')
-rw-r--r-- | net/irda/irttp.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 49c51c5f1a86..42acf1cde737 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -85,10 +85,9 @@ static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 }; | |||
85 | */ | 85 | */ |
86 | int __init irttp_init(void) | 86 | int __init irttp_init(void) |
87 | { | 87 | { |
88 | irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); | 88 | irttp = kzalloc(sizeof(struct irttp_cb), GFP_KERNEL); |
89 | if (irttp == NULL) | 89 | if (irttp == NULL) |
90 | return -ENOMEM; | 90 | return -ENOMEM; |
91 | memset(irttp, 0, sizeof(struct irttp_cb)); | ||
92 | 91 | ||
93 | irttp->magic = TTP_MAGIC; | 92 | irttp->magic = TTP_MAGIC; |
94 | 93 | ||
@@ -306,7 +305,8 @@ static inline void irttp_fragment_skb(struct tsap_cb *self, | |||
306 | IRDA_DEBUG(2, "%s(), fragmenting ...\n", __FUNCTION__); | 305 | IRDA_DEBUG(2, "%s(), fragmenting ...\n", __FUNCTION__); |
307 | 306 | ||
308 | /* Make new segment */ | 307 | /* Make new segment */ |
309 | frag = dev_alloc_skb(self->max_seg_size+self->max_header_size); | 308 | frag = alloc_skb(self->max_seg_size+self->max_header_size, |
309 | GFP_ATOMIC); | ||
310 | if (!frag) | 310 | if (!frag) |
311 | return; | 311 | return; |
312 | 312 | ||
@@ -389,12 +389,11 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) | |||
389 | return NULL; | 389 | return NULL; |
390 | } | 390 | } |
391 | 391 | ||
392 | self = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC); | 392 | self = kzalloc(sizeof(struct tsap_cb), GFP_ATOMIC); |
393 | if (self == NULL) { | 393 | if (self == NULL) { |
394 | IRDA_DEBUG(0, "%s(), unable to kmalloc!\n", __FUNCTION__); | 394 | IRDA_DEBUG(0, "%s(), unable to kmalloc!\n", __FUNCTION__); |
395 | return NULL; | 395 | return NULL; |
396 | } | 396 | } |
397 | memset(self, 0, sizeof(struct tsap_cb)); | ||
398 | spin_lock_init(&self->lock); | 397 | spin_lock_init(&self->lock); |
399 | 398 | ||
400 | /* Initialise todo timer */ | 399 | /* Initialise todo timer */ |
@@ -805,7 +804,7 @@ static inline void irttp_give_credit(struct tsap_cb *self) | |||
805 | self->send_credit, self->avail_credit, self->remote_credit); | 804 | self->send_credit, self->avail_credit, self->remote_credit); |
806 | 805 | ||
807 | /* Give credit to peer */ | 806 | /* Give credit to peer */ |
808 | tx_skb = dev_alloc_skb(64); | 807 | tx_skb = alloc_skb(64, GFP_ATOMIC); |
809 | if (!tx_skb) | 808 | if (!tx_skb) |
810 | return; | 809 | return; |
811 | 810 | ||
@@ -1094,7 +1093,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, | |||
1094 | 1093 | ||
1095 | /* Any userdata supplied? */ | 1094 | /* Any userdata supplied? */ |
1096 | if (userdata == NULL) { | 1095 | if (userdata == NULL) { |
1097 | tx_skb = dev_alloc_skb(64); | 1096 | tx_skb = alloc_skb(64, GFP_ATOMIC); |
1098 | if (!tx_skb) | 1097 | if (!tx_skb) |
1099 | return -ENOMEM; | 1098 | return -ENOMEM; |
1100 | 1099 | ||
@@ -1342,7 +1341,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, | |||
1342 | 1341 | ||
1343 | /* Any userdata supplied? */ | 1342 | /* Any userdata supplied? */ |
1344 | if (userdata == NULL) { | 1343 | if (userdata == NULL) { |
1345 | tx_skb = dev_alloc_skb(64); | 1344 | tx_skb = alloc_skb(64, GFP_ATOMIC); |
1346 | if (!tx_skb) | 1345 | if (!tx_skb) |
1347 | return -ENOMEM; | 1346 | return -ENOMEM; |
1348 | 1347 | ||
@@ -1541,7 +1540,7 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata, | |||
1541 | 1540 | ||
1542 | if (!userdata) { | 1541 | if (!userdata) { |
1543 | struct sk_buff *tx_skb; | 1542 | struct sk_buff *tx_skb; |
1544 | tx_skb = dev_alloc_skb(64); | 1543 | tx_skb = alloc_skb(64, GFP_ATOMIC); |
1545 | if (!tx_skb) | 1544 | if (!tx_skb) |
1546 | return -ENOMEM; | 1545 | return -ENOMEM; |
1547 | 1546 | ||
@@ -1876,7 +1875,7 @@ static int irttp_seq_open(struct inode *inode, struct file *file) | |||
1876 | int rc = -ENOMEM; | 1875 | int rc = -ENOMEM; |
1877 | struct irttp_iter_state *s; | 1876 | struct irttp_iter_state *s; |
1878 | 1877 | ||
1879 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 1878 | s = kzalloc(sizeof(*s), GFP_KERNEL); |
1880 | if (!s) | 1879 | if (!s) |
1881 | goto out; | 1880 | goto out; |
1882 | 1881 | ||
@@ -1886,7 +1885,6 @@ static int irttp_seq_open(struct inode *inode, struct file *file) | |||
1886 | 1885 | ||
1887 | seq = file->private_data; | 1886 | seq = file->private_data; |
1888 | seq->private = s; | 1887 | seq->private = s; |
1889 | memset(s, 0, sizeof(*s)); | ||
1890 | out: | 1888 | out: |
1891 | return rc; | 1889 | return rc; |
1892 | out_kfree: | 1890 | out_kfree: |