Commit 67b5d6ea authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] kill warnings 11/19

irias_object missused __FUNCTION__ too.
parent 3e9048cd
/********************************************************************* /*********************************************************************
* *
* Filename: irias_object.c * Filename: irias_object.c
* Version: 0.3 * Version: 0.3
* Description: IAS object database and functions * Description: IAS object database and functions
...@@ -8,18 +8,18 @@ ...@@ -8,18 +8,18 @@
* Created at: Thu Oct 1 22:50:04 1998 * Created at: Thu Oct 1 22:50:04 1998
* Modified at: Wed Dec 15 11:23:16 1999 * Modified at: Wed Dec 15 11:23:16 1999
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* Neither Dag Brattli nor University of Troms admit liability nor * Neither Dag Brattli nor University of Troms admit liability nor
* provide warranty for any of this software. This material is * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge. * provided "AS-IS" and at no charge.
* *
********************************************************************/ ********************************************************************/
#include <linux/string.h> #include <linux/string.h>
...@@ -47,7 +47,7 @@ char *strndup(char *str, int max) ...@@ -47,7 +47,7 @@ char *strndup(char *str, int max)
{ {
char *new_str; char *new_str;
int len; int len;
/* Check string */ /* Check string */
if (str == NULL) if (str == NULL)
return NULL; return NULL;
...@@ -59,14 +59,14 @@ char *strndup(char *str, int max) ...@@ -59,14 +59,14 @@ char *strndup(char *str, int max)
/* Allocate new string */ /* Allocate new string */
new_str = kmalloc(len + 1, GFP_ATOMIC); new_str = kmalloc(len + 1, GFP_ATOMIC);
if (new_str == NULL) { if (new_str == NULL) {
WARNING(__FUNCTION__"(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL; return NULL;
} }
/* Copy and truncate */ /* Copy and truncate */
memcpy(new_str, str, len); memcpy(new_str, str, len);
new_str[len] = '\0'; new_str[len] = '\0';
return new_str; return new_str;
} }
...@@ -79,10 +79,10 @@ char *strndup(char *str, int max) ...@@ -79,10 +79,10 @@ char *strndup(char *str, int max)
struct ias_object *irias_new_object( char *name, int id) struct ias_object *irias_new_object( char *name, int id)
{ {
struct ias_object *obj; struct ias_object *obj;
IRDA_DEBUG( 4, __FUNCTION__ "()\n"); IRDA_DEBUG( 4, __FUNCTION__ "()\n");
obj = (struct ias_object *) kmalloc(sizeof(struct ias_object), obj = (struct ias_object *) kmalloc(sizeof(struct ias_object),
GFP_ATOMIC); GFP_ATOMIC);
if (obj == NULL) { if (obj == NULL) {
IRDA_DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n"); IRDA_DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n");
...@@ -95,7 +95,7 @@ struct ias_object *irias_new_object( char *name, int id) ...@@ -95,7 +95,7 @@ struct ias_object *irias_new_object( char *name, int id)
obj->id = id; obj->id = id;
obj->attribs = hashbin_new(HB_LOCAL); obj->attribs = hashbin_new(HB_LOCAL);
return obj; return obj;
} }
...@@ -115,7 +115,7 @@ void __irias_delete_attrib(struct ias_attrib *attrib) ...@@ -115,7 +115,7 @@ void __irias_delete_attrib(struct ias_attrib *attrib)
irias_delete_value(attrib->value); irias_delete_value(attrib->value);
attrib->magic = ~IAS_ATTRIB_MAGIC; attrib->magic = ~IAS_ATTRIB_MAGIC;
kfree(attrib); kfree(attrib);
} }
...@@ -126,11 +126,11 @@ void __irias_delete_object(struct ias_object *obj) ...@@ -126,11 +126,11 @@ void __irias_delete_object(struct ias_object *obj)
if (obj->name) if (obj->name)
kfree(obj->name); kfree(obj->name);
hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib); hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib);
obj->magic = ~IAS_OBJECT_MAGIC; obj->magic = ~IAS_OBJECT_MAGIC;
kfree(obj); kfree(obj);
} }
...@@ -141,7 +141,7 @@ void __irias_delete_object(struct ias_object *obj) ...@@ -141,7 +141,7 @@ void __irias_delete_object(struct ias_object *obj)
* with this object and the object itself * with this object and the object itself
* *
*/ */
int irias_delete_object(struct ias_object *obj) int irias_delete_object(struct ias_object *obj)
{ {
struct ias_object *node; struct ias_object *node;
...@@ -164,7 +164,7 @@ int irias_delete_object(struct ias_object *obj) ...@@ -164,7 +164,7 @@ int irias_delete_object(struct ias_object *obj)
* the object, remove the object as well. * the object, remove the object as well.
* *
*/ */
int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib) int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib)
{ {
struct ias_attrib *node; struct ias_attrib *node;
...@@ -198,7 +198,7 @@ void irias_insert_object(struct ias_object *obj) ...@@ -198,7 +198,7 @@ void irias_insert_object(struct ias_object *obj)
{ {
ASSERT(obj != NULL, return;); ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
hashbin_insert(objects, (irda_queue_t *) obj, 0, obj->name); hashbin_insert(objects, (irda_queue_t *) obj, 0, obj->name);
} }
...@@ -247,7 +247,7 @@ void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib, ...@@ -247,7 +247,7 @@ void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib,
{ {
ASSERT(obj != NULL, return;); ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
ASSERT(attrib != NULL, return;); ASSERT(attrib != NULL, return;);
ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;); ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;);
...@@ -263,8 +263,8 @@ void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib, ...@@ -263,8 +263,8 @@ void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib,
* Change the value of an objects attribute. * Change the value of an objects attribute.
* *
*/ */
int irias_object_change_attribute(char *obj_name, char *attrib_name, int irias_object_change_attribute(char *obj_name, char *attrib_name,
struct ias_value *new_value) struct ias_value *new_value)
{ {
struct ias_object *obj; struct ias_object *obj;
struct ias_attrib *attrib; struct ias_attrib *attrib;
...@@ -272,7 +272,7 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name, ...@@ -272,7 +272,7 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name,
/* Find object */ /* Find object */
obj = hashbin_find(objects, 0, obj_name); obj = hashbin_find(objects, 0, obj_name);
if (obj == NULL) { if (obj == NULL) {
WARNING(__FUNCTION__ "(), Unable to find object: %s\n", WARNING("%s: Unable to find object: %s\n", __FUNCTION__,
obj_name); obj_name);
return -1; return -1;
} }
...@@ -280,20 +280,20 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name, ...@@ -280,20 +280,20 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name,
/* Find attribute */ /* Find attribute */
attrib = hashbin_find(obj->attribs, 0, attrib_name); attrib = hashbin_find(obj->attribs, 0, attrib_name);
if (attrib == NULL) { if (attrib == NULL) {
WARNING(__FUNCTION__ "(), Unable to find attribute: %s\n", WARNING("%s: Unable to find attribute: %s\n", __FUNCTION__,
attrib_name); attrib_name);
return -1; return -1;
} }
if ( attrib->value->type != new_value->type) { if ( attrib->value->type != new_value->type) {
IRDA_DEBUG( 0, __FUNCTION__ IRDA_DEBUG( 0, __FUNCTION__
"(), changing value type not allowed!\n"); "(), changing value type not allowed!\n");
return -1; return -1;
} }
/* Delete old value */ /* Delete old value */
irias_delete_value(attrib->value); irias_delete_value(attrib->value);
/* Insert new value */ /* Insert new value */
attrib->value = new_value; attrib->value = new_value;
...@@ -315,11 +315,11 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value, ...@@ -315,11 +315,11 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
ASSERT(obj != NULL, return;); ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
ASSERT(name != NULL, return;); ASSERT(name != NULL, return;);
attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
GFP_ATOMIC); GFP_ATOMIC);
if (attrib == NULL) { if (attrib == NULL) {
WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n"); WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
return; return;
} }
memset(attrib, 0, sizeof( struct ias_attrib)); memset(attrib, 0, sizeof( struct ias_attrib));
...@@ -329,7 +329,7 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value, ...@@ -329,7 +329,7 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
/* Insert value */ /* Insert value */
attrib->value = irias_new_integer_value(value); attrib->value = irias_new_integer_value(value);
irias_add_attrib(obj, attrib, owner); irias_add_attrib(obj, attrib, owner);
} }
...@@ -344,27 +344,26 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets, ...@@ -344,27 +344,26 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
int len, int owner) int len, int owner)
{ {
struct ias_attrib *attrib; struct ias_attrib *attrib;
ASSERT(obj != NULL, return;); ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
ASSERT(name != NULL, return;); ASSERT(name != NULL, return;);
ASSERT(octets != NULL, return;); ASSERT(octets != NULL, return;);
attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
GFP_ATOMIC); GFP_ATOMIC);
if (attrib == NULL) { if (attrib == NULL) {
WARNING(__FUNCTION__ WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
"(), Unable to allocate attribute!\n");
return; return;
} }
memset(attrib, 0, sizeof( struct ias_attrib)); memset(attrib, 0, sizeof( struct ias_attrib));
attrib->magic = IAS_ATTRIB_MAGIC; attrib->magic = IAS_ATTRIB_MAGIC;
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
attrib->value = irias_new_octseq_value( octets, len); attrib->value = irias_new_octseq_value( octets, len);
irias_add_attrib(obj, attrib, owner); irias_add_attrib(obj, attrib, owner);
} }
...@@ -384,11 +383,11 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value, ...@@ -384,11 +383,11 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
ASSERT(name != NULL, return;); ASSERT(name != NULL, return;);
ASSERT(value != NULL, return;); ASSERT(value != NULL, return;);
attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib), attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib),
GFP_ATOMIC); GFP_ATOMIC);
if (attrib == NULL) { if (attrib == NULL) {
WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n"); WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
return; return;
} }
memset(attrib, 0, sizeof( struct ias_attrib)); memset(attrib, 0, sizeof( struct ias_attrib));
...@@ -413,7 +412,7 @@ struct ias_value *irias_new_integer_value(int integer) ...@@ -413,7 +412,7 @@ struct ias_value *irias_new_integer_value(int integer)
value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) { if (value == NULL) {
WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL; return NULL;
} }
memset(value, 0, sizeof(struct ias_value)); memset(value, 0, sizeof(struct ias_value));
...@@ -438,7 +437,7 @@ struct ias_value *irias_new_string_value(char *string) ...@@ -438,7 +437,7 @@ struct ias_value *irias_new_string_value(char *string)
value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) { if (value == NULL) {
WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL; return NULL;
} }
memset( value, 0, sizeof( struct ias_value)); memset( value, 0, sizeof( struct ias_value));
...@@ -465,7 +464,7 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len) ...@@ -465,7 +464,7 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) { if (value == NULL) {
WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL; return NULL;
} }
memset(value, 0, sizeof(struct ias_value)); memset(value, 0, sizeof(struct ias_value));
...@@ -478,7 +477,7 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len) ...@@ -478,7 +477,7 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
value->t.oct_seq = kmalloc(len, GFP_ATOMIC); value->t.oct_seq = kmalloc(len, GFP_ATOMIC);
if (value->t.oct_seq == NULL){ if (value->t.oct_seq == NULL){
WARNING(__FUNCTION__"(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
kfree(value); kfree(value);
return NULL; return NULL;
} }
...@@ -492,7 +491,7 @@ struct ias_value *irias_new_missing_value(void) ...@@ -492,7 +491,7 @@ struct ias_value *irias_new_missing_value(void)
value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) { if (value == NULL) {
WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL; return NULL;
} }
memset(value, 0, sizeof(struct ias_value)); memset(value, 0, sizeof(struct ias_value));
...@@ -536,6 +535,3 @@ void irias_delete_value(struct ias_value *value) ...@@ -536,6 +535,3 @@ void irias_delete_value(struct ias_value *value)
} }
kfree(value); kfree(value);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment