netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <erik.hugne@ericsson.com>
To: <netdev@vger.kernel.org>
Cc: <tipc-discussion@lists.sourceforge.net>,
	Erik Hugne <erik.hugne@ericsson.com>
Subject: [PATCH net-next] tipc: fix sparse warnings
Date: Wed, 10 Sep 2014 14:02:50 +0200	[thread overview]
Message-ID: <1410350570-6145-1-git-send-email-erik.hugne@ericsson.com> (raw)

From: Erik Hugne <erik.hugne@ericsson.com>

This fixes the following sparse warnings:
sparse: symbol 'tipc_update_nametbl' was not declared. Should it be static?
Also, the function is changed to return bool upon success, rather than a
potentially freed pointer.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/tipc/name_distr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 780ef71..376d2bb 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -284,8 +284,7 @@ static void named_purge_publ(struct publication *publ)
  * tipc_nametbl_lock must be held.
  * Returns the publication item if successful, otherwise NULL.
  */
-struct publication *tipc_update_nametbl(struct distr_item *i, u32 node,
-					u32 dtype)
+static bool tipc_update_nametbl(struct distr_item *i, u32 node, u32 dtype)
 {
 	struct publication *publ = NULL;
 
@@ -298,6 +297,7 @@ struct publication *tipc_update_nametbl(struct distr_item *i, u32 node,
 			tipc_nodesub_subscribe(&publ->subscr, node, publ,
 					       (net_ev_handler)
 					       named_purge_publ);
+			return true;
 		}
 	} else if (dtype == WITHDRAWAL) {
 		publ = tipc_nametbl_remove_publ(ntohl(i->type), ntohl(i->lower),
@@ -306,11 +306,12 @@ struct publication *tipc_update_nametbl(struct distr_item *i, u32 node,
 		if (publ) {
 			tipc_nodesub_unsubscribe(&publ->subscr);
 			kfree(publ);
+			return true;
 		}
 	} else {
 		pr_warn("Unrecognized name table message received\n");
 	}
-	return publ;
+	return false;
 }
 
 /**
-- 
1.8.3.2

             reply	other threads:[~2014-09-10 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 12:02 erik.hugne [this message]
2014-09-10 21:01 ` [PATCH net-next] tipc: fix sparse warnings David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410350570-6145-1-git-send-email-erik.hugne@ericsson.com \
    --to=erik.hugne@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).