* [PATCH net-next] tipc: fix sparse warnings
@ 2014-09-10 12:02 erik.hugne
2014-09-10 21:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: erik.hugne @ 2014-09-10 12:02 UTC (permalink / raw)
To: netdev; +Cc: tipc-discussion, Erik Hugne
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] tipc: fix sparse warnings
2014-09-10 12:02 [PATCH net-next] tipc: fix sparse warnings erik.hugne
@ 2014-09-10 21:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-09-10 21:01 UTC (permalink / raw)
To: erik.hugne; +Cc: netdev, tipc-discussion
From: <erik.hugne@ericsson.com>
Date: Wed, 10 Sep 2014 14:02:50 +0200
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-10 21:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 12:02 [PATCH net-next] tipc: fix sparse warnings erik.hugne
2014-09-10 21:01 ` David Miller
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).