mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-18 12:46:50 +00:00
dcbnl: Use dcbnl_newmsg() where possible
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
77c6849d7a
commit
ab6d470735
1 changed files with 2 additions and 14 deletions
|
|
@ -1328,27 +1328,16 @@ static int dcbnl_notify(struct net_device *dev, int event, int cmd,
|
||||||
struct net *net = dev_net(dev);
|
struct net *net = dev_net(dev);
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct nlmsghdr *nlh;
|
struct nlmsghdr *nlh;
|
||||||
struct dcbmsg *dcb;
|
|
||||||
const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
|
const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!ops)
|
if (!ops)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
skb = dcbnl_newmsg(event, cmd, pid, seq, 0, &nlh);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
nlh = nlmsg_put(skb, pid, 0, event, sizeof(*dcb), 0);
|
|
||||||
if (nlh == NULL) {
|
|
||||||
nlmsg_free(skb);
|
|
||||||
return -EMSGSIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcb = NLMSG_DATA(nlh);
|
|
||||||
dcb->dcb_family = AF_UNSPEC;
|
|
||||||
dcb->cmd = cmd;
|
|
||||||
|
|
||||||
if (dcbx_ver == DCB_CAP_DCBX_VER_IEEE)
|
if (dcbx_ver == DCB_CAP_DCBX_VER_IEEE)
|
||||||
err = dcbnl_ieee_fill(skb, dev);
|
err = dcbnl_ieee_fill(skb, dev);
|
||||||
else
|
else
|
||||||
|
|
@ -1356,8 +1345,7 @@ static int dcbnl_notify(struct net_device *dev, int event, int cmd,
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
/* Report error to broadcast listeners */
|
/* Report error to broadcast listeners */
|
||||||
nlmsg_cancel(skb, nlh);
|
nlmsg_free(skb);
|
||||||
kfree_skb(skb);
|
|
||||||
rtnl_set_sk_err(net, RTNLGRP_DCB, err);
|
rtnl_set_sk_err(net, RTNLGRP_DCB, err);
|
||||||
} else {
|
} else {
|
||||||
/* End nlmsg and notify broadcast listeners */
|
/* End nlmsg and notify broadcast listeners */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue