diff options
Diffstat (limited to 'net/irda/irlmp.c')
| -rw-r--r-- | net/irda/irlmp.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 57ea160f470b..5073261b9d0c 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | * | 24 | * |
| 25 | ********************************************************************/ | 25 | ********************************************************************/ |
| 26 | 26 | ||
| 27 | #include <linux/config.h> | ||
| 28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 30 | #include <linux/string.h> | 29 | #include <linux/string.h> |
| @@ -79,10 +78,9 @@ int __init irlmp_init(void) | |||
| 79 | { | 78 | { |
| 80 | IRDA_DEBUG(1, "%s()\n", __FUNCTION__); | 79 | IRDA_DEBUG(1, "%s()\n", __FUNCTION__); |
| 81 | /* Initialize the irlmp structure. */ | 80 | /* Initialize the irlmp structure. */ |
| 82 | irlmp = kmalloc( sizeof(struct irlmp_cb), GFP_KERNEL); | 81 | irlmp = kzalloc( sizeof(struct irlmp_cb), GFP_KERNEL); |
| 83 | if (irlmp == NULL) | 82 | if (irlmp == NULL) |
| 84 | return -ENOMEM; | 83 | return -ENOMEM; |
| 85 | memset(irlmp, 0, sizeof(struct irlmp_cb)); | ||
| 86 | 84 | ||
| 87 | irlmp->magic = LMP_MAGIC; | 85 | irlmp->magic = LMP_MAGIC; |
| 88 | 86 | ||
| @@ -161,12 +159,11 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify, __u8 pid) | |||
| 161 | return NULL; | 159 | return NULL; |
| 162 | 160 | ||
| 163 | /* Allocate new instance of a LSAP connection */ | 161 | /* Allocate new instance of a LSAP connection */ |
| 164 | self = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC); | 162 | self = kzalloc(sizeof(struct lsap_cb), GFP_ATOMIC); |
| 165 | if (self == NULL) { | 163 | if (self == NULL) { |
| 166 | IRDA_ERROR("%s: can't allocate memory\n", __FUNCTION__); | 164 | IRDA_ERROR("%s: can't allocate memory\n", __FUNCTION__); |
| 167 | return NULL; | 165 | return NULL; |
| 168 | } | 166 | } |
| 169 | memset(self, 0, sizeof(struct lsap_cb)); | ||
| 170 | 167 | ||
| 171 | self->magic = LMP_LSAP_MAGIC; | 168 | self->magic = LMP_LSAP_MAGIC; |
| 172 | self->slsap_sel = slsap_sel; | 169 | self->slsap_sel = slsap_sel; |
| @@ -289,12 +286,11 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify) | |||
| 289 | /* | 286 | /* |
| 290 | * Allocate new instance of a LSAP connection | 287 | * Allocate new instance of a LSAP connection |
| 291 | */ | 288 | */ |
| 292 | lap = kmalloc(sizeof(struct lap_cb), GFP_KERNEL); | 289 | lap = kzalloc(sizeof(struct lap_cb), GFP_KERNEL); |
| 293 | if (lap == NULL) { | 290 | if (lap == NULL) { |
| 294 | IRDA_ERROR("%s: unable to kmalloc\n", __FUNCTION__); | 291 | IRDA_ERROR("%s: unable to kmalloc\n", __FUNCTION__); |
| 295 | return; | 292 | return; |
| 296 | } | 293 | } |
| 297 | memset(lap, 0, sizeof(struct lap_cb)); | ||
| 298 | 294 | ||
| 299 | lap->irlap = irlap; | 295 | lap->irlap = irlap; |
| 300 | lap->magic = LMP_LAP_MAGIC; | 296 | lap->magic = LMP_LAP_MAGIC; |
| @@ -396,7 +392,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel, | |||
| 396 | 392 | ||
| 397 | /* Any userdata? */ | 393 | /* Any userdata? */ |
| 398 | if (tx_skb == NULL) { | 394 | if (tx_skb == NULL) { |
| 399 | tx_skb = dev_alloc_skb(64); | 395 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
| 400 | if (!tx_skb) | 396 | if (!tx_skb) |
| 401 | return -ENOMEM; | 397 | return -ENOMEM; |
| 402 | 398 | ||
