diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2006-03-21 01:21:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:21:40 -0500 |
commit | b191ba0d599928372be5a89f75486eb58efab48a (patch) | |
tree | a0ecc636d121126aba838d49700ad9cfbbf94733 /drivers/connector | |
parent | 0ac81ae34ec8898e7eb1388fe21e3cee7b626a88 (diff) |
[CONNECTOR]: Use netlink_has_listeners() to avoind unnecessary allocations.
Return -ESRCH from cn_netlink_send() when there are not listeners,
just as it could be done by netlink_broadcast(). Propagate
netlink_broadcast() error back to the caller.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector')
-rw-r--r-- | drivers/connector/connector.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 505677fb3157..d7125f4d9113 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -97,6 +97,9 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) | |||
97 | group = __group; | 97 | group = __group; |
98 | } | 98 | } |
99 | 99 | ||
100 | if (!netlink_has_listeners(dev->nls, group)) | ||
101 | return -ESRCH; | ||
102 | |||
100 | size = NLMSG_SPACE(sizeof(*msg) + msg->len); | 103 | size = NLMSG_SPACE(sizeof(*msg) + msg->len); |
101 | 104 | ||
102 | skb = alloc_skb(size, gfp_mask); | 105 | skb = alloc_skb(size, gfp_mask); |
@@ -111,9 +114,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) | |||
111 | 114 | ||
112 | NETLINK_CB(skb).dst_group = group; | 115 | NETLINK_CB(skb).dst_group = group; |
113 | 116 | ||
114 | netlink_broadcast(dev->nls, skb, 0, group, gfp_mask); | 117 | return netlink_broadcast(dev->nls, skb, 0, group, gfp_mask); |
115 | |||
116 | return 0; | ||
117 | 118 | ||
118 | nlmsg_failure: | 119 | nlmsg_failure: |
119 | kfree_skb(skb); | 120 | kfree_skb(skb); |