{
struct sk_buff *skb;
void *msg_header;
- int ret;
+ int ret = -ENOMEM;
skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!skb)
- return -ENOMEM;
+ return ret;
msg_header = genlmsg_put(skb, 0, 0, &tcmu_genl_family, 0, cmd);
- if (!msg_header) {
- nlmsg_free(skb);
- return -ENOMEM;
- }
+ if (!msg_header)
+ goto free_skb;
ret = nla_put_string(skb, TCMU_ATTR_DEVICE, name);
+ if (ret < 0)
+ goto free_skb;
ret = nla_put_u32(skb, TCMU_ATTR_MINOR, minor);
+ if (ret < 0)
+ goto free_skb;
ret = genlmsg_end(skb, msg_header);
- if (ret < 0) {
- nlmsg_free(skb);
- return ret;
- }
+ if (ret < 0)
+ goto free_skb;
ret = genlmsg_multicast(&tcmu_genl_family, skb, 0,
TCMU_MCGRP_CONFIG, GFP_KERNEL);
ret = 0;
return ret;
+free_skb:
+ nlmsg_free(skb);
+ return ret;
}
static int tcmu_configure_device(struct se_device *dev)