From 1a1f37d9257a4792ca17b28b1c2e4ad15fe95b28 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Sun, 10 Jul 2011 00:36:36 +0200 Subject: batman-adv: hash_add() has to discriminate on the return value hash_add() returns 0 on success while returns -1 either on error and on entry already present. The caller could use such information to select its behaviour. For this reason it is useful that hash_add() returns -1 in case on error and returns 1 in case of entry already present. Signed-off-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/vis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/batman-adv/vis.c') diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 8a1b98589d76..8b75cc562053 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c @@ -465,7 +465,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, /* try to add it */ hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose, info, &info->hash_entry); - if (hash_added < 0) { + if (hash_added != 0) { /* did not work (for some reason) */ kref_put(&info->refcount, free_info); info = NULL; @@ -920,7 +920,7 @@ int vis_init(struct bat_priv *bat_priv) hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose, bat_priv->my_vis_info, &bat_priv->my_vis_info->hash_entry); - if (hash_added < 0) { + if (hash_added != 0) { pr_err("Can't add own vis packet into hash\n"); /* not in hash, need to remove it manually. */ kref_put(&bat_priv->my_vis_info->refcount, free_info); -- cgit 1.4.1