diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-26 21:19:02 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-26 21:19:02 -0700 |
commit | 8786395c6956ae16cd04cc8c55e0f5fcd45fa939 (patch) | |
tree | a4f51e9bc441a618ad8ea5249b35e594e0dd62eb | |
parent | 85c931665d822f1bedd69ecaab09a8ba84643020 (diff) | |
download | lwn-8786395c6956ae16cd04cc8c55e0f5fcd45fa939.tar.gz lwn-8786395c6956ae16cd04cc8c55e0f5fcd45fa939.zip |
connector: Move cn_test.c away from NLMSG_PUT().
And use nlmsg_data() while we're here too.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/connector/cn_test.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c index 7764594778d4..adcca0368d60 100644 --- a/Documentation/connector/cn_test.c +++ b/Documentation/connector/cn_test.c @@ -69,9 +69,13 @@ static int cn_test_want_notify(void) return -ENOMEM; } - nlh = NLMSG_PUT(skb, 0, 0x123, NLMSG_DONE, size - sizeof(*nlh)); + nlh = nlmsg_put(skb, 0, 0x123, NLMSG_DONE, size - sizeof(*nlh), 0); + if (!nlh) { + kfree_skb(skb); + return -EMSGSIZE; + } - msg = (struct cn_msg *)NLMSG_DATA(nlh); + msg = nlmsg_data(nlh); memset(msg, 0, size0); @@ -117,11 +121,6 @@ static int cn_test_want_notify(void) pr_info("request was sent: group=0x%x\n", ctl->group); return 0; - -nlmsg_failure: - pr_err("failed to send %u.%u\n", msg->seq, msg->ack); - kfree_skb(skb); - return -EINVAL; } #endif |