diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-07-21 17:51:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-21 17:51:30 -0400 |
commit | 0da974f4f303a6842516b764507e3c0a03f41e5a (patch) | |
tree | 8872aec792f02040269c6769dd1009b20f71d186 /net/irda/irias_object.c | |
parent | a0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff) |
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irias_object.c')
-rw-r--r-- | net/irda/irias_object.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 82e665c79991..a154b1d71c0f 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c | |||
@@ -82,13 +82,12 @@ struct ias_object *irias_new_object( char *name, int id) | |||
82 | 82 | ||
83 | IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); | 83 | IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); |
84 | 84 | ||
85 | obj = kmalloc(sizeof(struct ias_object), GFP_ATOMIC); | 85 | obj = kzalloc(sizeof(struct ias_object), GFP_ATOMIC); |
86 | if (obj == NULL) { | 86 | if (obj == NULL) { |
87 | IRDA_WARNING("%s(), Unable to allocate object!\n", | 87 | IRDA_WARNING("%s(), Unable to allocate object!\n", |
88 | __FUNCTION__); | 88 | __FUNCTION__); |
89 | return NULL; | 89 | return NULL; |
90 | } | 90 | } |
91 | memset(obj, 0, sizeof( struct ias_object)); | ||
92 | 91 | ||
93 | obj->magic = IAS_OBJECT_MAGIC; | 92 | obj->magic = IAS_OBJECT_MAGIC; |
94 | obj->name = strndup(name, IAS_MAX_CLASSNAME); | 93 | obj->name = strndup(name, IAS_MAX_CLASSNAME); |
@@ -346,13 +345,12 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value, | |||
346 | IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); | 345 | IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); |
347 | IRDA_ASSERT(name != NULL, return;); | 346 | IRDA_ASSERT(name != NULL, return;); |
348 | 347 | ||
349 | attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); | 348 | attrib = kzalloc(sizeof(struct ias_attrib), GFP_ATOMIC); |
350 | if (attrib == NULL) { | 349 | if (attrib == NULL) { |
351 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 350 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
352 | __FUNCTION__); | 351 | __FUNCTION__); |
353 | return; | 352 | return; |
354 | } | 353 | } |
355 | memset(attrib, 0, sizeof( struct ias_attrib)); | ||
356 | 354 | ||
357 | attrib->magic = IAS_ATTRIB_MAGIC; | 355 | attrib->magic = IAS_ATTRIB_MAGIC; |
358 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); | 356 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); |
@@ -382,13 +380,12 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets, | |||
382 | IRDA_ASSERT(name != NULL, return;); | 380 | IRDA_ASSERT(name != NULL, return;); |
383 | IRDA_ASSERT(octets != NULL, return;); | 381 | IRDA_ASSERT(octets != NULL, return;); |
384 | 382 | ||
385 | attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); | 383 | attrib = kzalloc(sizeof(struct ias_attrib), GFP_ATOMIC); |
386 | if (attrib == NULL) { | 384 | if (attrib == NULL) { |
387 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 385 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
388 | __FUNCTION__); | 386 | __FUNCTION__); |
389 | return; | 387 | return; |
390 | } | 388 | } |
391 | memset(attrib, 0, sizeof( struct ias_attrib)); | ||
392 | 389 | ||
393 | attrib->magic = IAS_ATTRIB_MAGIC; | 390 | attrib->magic = IAS_ATTRIB_MAGIC; |
394 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); | 391 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); |
@@ -416,13 +413,12 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value, | |||
416 | IRDA_ASSERT(name != NULL, return;); | 413 | IRDA_ASSERT(name != NULL, return;); |
417 | IRDA_ASSERT(value != NULL, return;); | 414 | IRDA_ASSERT(value != NULL, return;); |
418 | 415 | ||
419 | attrib = kmalloc(sizeof( struct ias_attrib), GFP_ATOMIC); | 416 | attrib = kzalloc(sizeof( struct ias_attrib), GFP_ATOMIC); |
420 | if (attrib == NULL) { | 417 | if (attrib == NULL) { |
421 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 418 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
422 | __FUNCTION__); | 419 | __FUNCTION__); |
423 | return; | 420 | return; |
424 | } | 421 | } |
425 | memset(attrib, 0, sizeof( struct ias_attrib)); | ||
426 | 422 | ||
427 | attrib->magic = IAS_ATTRIB_MAGIC; | 423 | attrib->magic = IAS_ATTRIB_MAGIC; |
428 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); | 424 | attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); |
@@ -443,12 +439,11 @@ struct ias_value *irias_new_integer_value(int integer) | |||
443 | { | 439 | { |
444 | struct ias_value *value; | 440 | struct ias_value *value; |
445 | 441 | ||
446 | value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); | 442 | value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC); |
447 | if (value == NULL) { | 443 | if (value == NULL) { |
448 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); | 444 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); |
449 | return NULL; | 445 | return NULL; |
450 | } | 446 | } |
451 | memset(value, 0, sizeof(struct ias_value)); | ||
452 | 447 | ||
453 | value->type = IAS_INTEGER; | 448 | value->type = IAS_INTEGER; |
454 | value->len = 4; | 449 | value->len = 4; |
@@ -469,12 +464,11 @@ struct ias_value *irias_new_string_value(char *string) | |||
469 | { | 464 | { |
470 | struct ias_value *value; | 465 | struct ias_value *value; |
471 | 466 | ||
472 | value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); | 467 | value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC); |
473 | if (value == NULL) { | 468 | if (value == NULL) { |
474 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); | 469 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); |
475 | return NULL; | 470 | return NULL; |
476 | } | 471 | } |
477 | memset( value, 0, sizeof( struct ias_value)); | ||
478 | 472 | ||
479 | value->type = IAS_STRING; | 473 | value->type = IAS_STRING; |
480 | value->charset = CS_ASCII; | 474 | value->charset = CS_ASCII; |
@@ -495,12 +489,11 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len) | |||
495 | { | 489 | { |
496 | struct ias_value *value; | 490 | struct ias_value *value; |
497 | 491 | ||
498 | value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); | 492 | value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC); |
499 | if (value == NULL) { | 493 | if (value == NULL) { |
500 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); | 494 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); |
501 | return NULL; | 495 | return NULL; |
502 | } | 496 | } |
503 | memset(value, 0, sizeof(struct ias_value)); | ||
504 | 497 | ||
505 | value->type = IAS_OCT_SEQ; | 498 | value->type = IAS_OCT_SEQ; |
506 | /* Check length */ | 499 | /* Check length */ |
@@ -522,12 +515,11 @@ struct ias_value *irias_new_missing_value(void) | |||
522 | { | 515 | { |
523 | struct ias_value *value; | 516 | struct ias_value *value; |
524 | 517 | ||
525 | value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); | 518 | value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC); |
526 | if (value == NULL) { | 519 | if (value == NULL) { |
527 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); | 520 | IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); |
528 | return NULL; | 521 | return NULL; |
529 | } | 522 | } |
530 | memset(value, 0, sizeof(struct ias_value)); | ||
531 | 523 | ||
532 | value->type = IAS_MISSING; | 524 | value->type = IAS_MISSING; |
533 | value->len = 0; | 525 | value->len = 0; |