diff options
author | Thomas Graf <tgraf@suug.ch> | 2012-06-12 22:54:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-13 18:46:34 -0400 |
commit | ab6d470735682a6e1ba889a66f56eb1640242096 (patch) | |
tree | f484562de5385fadb8e929871d4d879ed4c50b60 /net/dcb | |
parent | 77c6849d7aca31a0743be51412853079fcea03e0 (diff) |
dcbnl: Use dcbnl_newmsg() where possible
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb')
-rw-r--r-- | net/dcb/dcbnl.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 5ed71674a4a1..4d9e0ef23d9f 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -1328,27 +1328,16 @@ static int dcbnl_notify(struct net_device *dev, int event, int cmd, | |||
1328 | struct net *net = dev_net(dev); | 1328 | struct net *net = dev_net(dev); |
1329 | struct sk_buff *skb; | 1329 | struct sk_buff *skb; |
1330 | struct nlmsghdr *nlh; | 1330 | struct nlmsghdr *nlh; |
1331 | struct dcbmsg *dcb; | ||
1332 | const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops; | 1331 | const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops; |
1333 | int err; | 1332 | int err; |
1334 | 1333 | ||
1335 | if (!ops) | 1334 | if (!ops) |
1336 | return -EOPNOTSUPP; | 1335 | return -EOPNOTSUPP; |
1337 | 1336 | ||
1338 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 1337 | skb = dcbnl_newmsg(event, cmd, pid, seq, 0, &nlh); |
1339 | if (!skb) | 1338 | if (!skb) |
1340 | return -ENOBUFS; | 1339 | return -ENOBUFS; |
1341 | 1340 | ||
1342 | nlh = nlmsg_put(skb, pid, 0, event, sizeof(*dcb), 0); | ||
1343 | if (nlh == NULL) { | ||
1344 | nlmsg_free(skb); | ||
1345 | return -EMSGSIZE; | ||
1346 | } | ||
1347 | |||
1348 | dcb = NLMSG_DATA(nlh); | ||
1349 | dcb->dcb_family = AF_UNSPEC; | ||
1350 | dcb->cmd = cmd; | ||
1351 | |||
1352 | if (dcbx_ver == DCB_CAP_DCBX_VER_IEEE) | 1341 | if (dcbx_ver == DCB_CAP_DCBX_VER_IEEE) |
1353 | err = dcbnl_ieee_fill(skb, dev); | 1342 | err = dcbnl_ieee_fill(skb, dev); |
1354 | else | 1343 | else |
@@ -1356,8 +1345,7 @@ static int dcbnl_notify(struct net_device *dev, int event, int cmd, | |||
1356 | 1345 | ||
1357 | if (err < 0) { | 1346 | if (err < 0) { |
1358 | /* Report error to broadcast listeners */ | 1347 | /* Report error to broadcast listeners */ |
1359 | nlmsg_cancel(skb, nlh); | 1348 | nlmsg_free(skb); |
1360 | kfree_skb(skb); | ||
1361 | rtnl_set_sk_err(net, RTNLGRP_DCB, err); | 1349 | rtnl_set_sk_err(net, RTNLGRP_DCB, err); |
1362 | } else { | 1350 | } else { |
1363 | /* End nlmsg and notify broadcast listeners */ | 1351 | /* End nlmsg and notify broadcast listeners */ |