struct acpi_genl_event *event;
        void *msg_header;
        int size;
-       int result;
 
        /* allocate memory */
        size = nla_total_size(sizeof(struct acpi_genl_event)) +
        event->data = data;
 
        /* send multicast genetlink message */
-       result = genlmsg_end(skb, msg_header);
-       if (result < 0) {
-               nlmsg_free(skb);
-               return result;
-       }
+       genlmsg_end(skb, msg_header);
 
        genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC);
        return 0;
 
        if (vid && nla_put_u16(skb, NDA_VLAN, vid))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        if (res < 0)
                goto out_err;
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 out_err:
        genlmsg_cancel(skb, hdr);
 
        }
 
        /* send genetlink multicast message to notify appplications */
-       result = genlmsg_end(skb, msg_header);
-
-       if (result < 0) {
-               pmcraid_err("genlmsg_end failed\n");
-               nlmsg_free(skb);
-               return result;
-       }
+       genlmsg_end(skb, msg_header);
 
        result = genlmsg_multicast(&pmcraid_event_family, skb,
                                   0, 0, GFP_ATOMIC);
 
        if (ret < 0)
                goto free_skb;
 
-       ret = genlmsg_end(skb, msg_header);
-       if (ret < 0)
-               goto free_skb;
+       genlmsg_end(skb, msg_header);
 
        ret = genlmsg_multicast(&tcmu_genl_family, skb, 0,
                                TCMU_MCGRP_CONFIG, GFP_KERNEL);
 
        thermal_event->event = event;
 
        /* send multicast genetlink message */
-       result = genlmsg_end(skb, msg_header);
-       if (result < 0) {
-               nlmsg_free(skb);
-               return result;
-       }
+       genlmsg_end(skb, msg_header);
 
        result = genlmsg_multicast(&thermal_event_genl_family, skb, 0,
                                   0, GFP_ATOMIC);
 
 {
        struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data);
        void *data = genlmsg_data(genlhdr);
-       int rv;
 
-       rv = genlmsg_end(skb, data);
-       if (rv < 0) {
-               nlmsg_free(skb);
-               return rv;
-       }
+       genlmsg_end(skb, data);
 
        return genlmsg_unicast(&init_net, skb, listener_nlportid);
 }
 
  * @skb: socket buffer the message is stored in
  * @hdr: user specific header
  */
-static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
+static inline void genlmsg_end(struct sk_buff *skb, void *hdr)
 {
-       return nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
+       nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
 }
 
 /**
 
  * Corrects the netlink message header to include the appeneded
  * attributes. Only necessary if attributes have been added to
  * the message.
- *
- * Returns the total data length of the skb.
  */
-static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
+static inline void nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
        nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh;
-
-       return skb->len;
 }
 
 /**
 
 {
        struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb));
        void *reply = genlmsg_data(genlhdr);
-       int rc;
 
-       rc = genlmsg_end(skb, reply);
-       if (rc < 0) {
-               nlmsg_free(skb);
-               return rc;
-       }
+       genlmsg_end(skb, reply);
 
        return genlmsg_reply(skb, info);
 }
        void *reply = genlmsg_data(genlhdr);
        int rc, delcount = 0;
 
-       rc = genlmsg_end(skb, reply);
-       if (rc < 0) {
-               nlmsg_free(skb);
-               return;
-       }
+       genlmsg_end(skb, reply);
 
        rc = 0;
        down_read(&listeners->sem);
 
        if (fdb->vlan_id && nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
 
        nla_nest_end(skb, nest2);
        nla_nest_end(skb, nest);
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 end:
        nla_nest_end(skb, nest);
 
        }
 
 done:
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                        goto cancel;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 cancel:
        nlmsg_cancel(skb, nlh);
 
        if (ops->fill(rule, skb, frh) < 0)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                goto nla_put_failure;
 
        read_unlock_bh(&tbl->lock);
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        read_unlock_bh(&tbl->lock);
                goto errout;
 
        read_unlock_bh(&tbl->lock);
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 errout:
        read_unlock_bh(&tbl->lock);
        nlmsg_cancel(skb, nlh);
            nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
        if (nla_put(skb, NDA_DST, tbl->key_len, pn->key))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
 
        nla_nest_end(skb, af_spec);
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
        if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        nla_nest_end(skb, protinfo);
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
        return -EMSGSIZE;
 
             nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) ||
             nla_put_u32(skb, IFA_FLAGS, ifa_flags))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
            nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0)
                goto errout;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 errout:
        nlmsg_cancel(skb, nlh);
 
                nla_nest_end(skb, mp_head);
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 errout:
        nlmsg_cancel(skb, nlh);
 
        struct nlmsghdr *nlh = nlmsg_hdr(msg);
        void *hdr = genlmsg_data(nlmsg_data(nlh));
 
-       if (genlmsg_end(msg, hdr) < 0)
-               goto out;
+       genlmsg_end(msg, hdr);
 
        return genlmsg_multicast(&nl802154_family, msg, 0, group, GFP_ATOMIC);
-out:
-       nlmsg_free(msg);
-       return -ENOBUFS;
 }
 
 struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
        struct nlmsghdr *nlh = nlmsg_hdr(msg);
        void *hdr = genlmsg_data(nlmsg_data(nlh));
 
-       if (genlmsg_end(msg, hdr) < 0)
-               goto out;
+       genlmsg_end(msg, hdr);
 
        return genlmsg_reply(msg, info);
-out:
-       nlmsg_free(msg);
-       return -ENOBUFS;
 }
 
 static const struct genl_ops ieee8021154_ops[] = {
 
        }
 
        wpan_phy_put(phy);
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        wpan_phy_put(phy);
 
                goto nla_put_failure;
        mutex_unlock(&phy->pib_lock);
        kfree(buf);
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        mutex_unlock(&phy->pib_lock);
 
                goto nla_put_failure;
 
 finish:
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(msg, hdr);
        if (nla_put_u8(msg, NL802154_ATTR_LBT_MODE, wpan_dev->lbt))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(msg, hdr);
 
                          preferred, valid))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
                                if (inet_fill_ifaddr(skb, ifa,
                                             NETLINK_CB(cb->skb).portid,
                                             cb->nlh->nlmsg_seq,
-                                            RTM_NEWADDR, NLM_F_MULTI) <= 0) {
+                                            RTM_NEWADDR, NLM_F_MULTI) < 0) {
                                        rcu_read_unlock();
                                        goto done;
                                }
                        IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                nla_nest_end(skb, mp);
        }
 #endif
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                icsk->icsk_ca_ops->get_info(sk, ext, skb);
 
 out:
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 errout:
        nlmsg_cancel(skb, nlh);
        }
 #endif
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
        }
 #endif
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
 
        if (err < 0 && err != -ENOENT)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        if (tcp_metrics_fill_info(skb, tm) < 0)
                goto nla_put_failure;
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
 
            nla_put_s32(skb, NETCONFA_PROXY_NEIGH, devconf->proxy_ndp) < 0)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
                                                       cb->nlh->nlmsg_seq,
                                                       RTM_NEWNETCONF,
                                                       NLM_F_MULTI,
-                                                      -1) <= 0) {
+                                                      -1) < 0) {
                                rcu_read_unlock();
                                goto done;
                        }
                                               NETLINK_CB(cb->skb).portid,
                                               cb->nlh->nlmsg_seq,
                                               RTM_NEWNETCONF, NLM_F_MULTI,
-                                              -1) <= 0)
+                                              -1) < 0)
                        goto done;
                else
                        h++;
                                               NETLINK_CB(cb->skb).portid,
                                               cb->nlh->nlmsg_seq,
                                               RTM_NEWNETCONF, NLM_F_MULTI,
-                                              -1) <= 0)
+                                              -1) < 0)
                        goto done;
                else
                        h++;
        if (nla_put_u32(skb, IFA_FLAGS, ifa->flags) < 0)
                goto error;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 error:
        nlmsg_cancel(skb, nlh);
                return -EMSGSIZE;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
                return -EMSGSIZE;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 enum addr_type_t {
                                                cb->nlh->nlmsg_seq,
                                                RTM_NEWADDR,
                                                NLM_F_MULTI);
-                       if (err <= 0)
+                       if (err < 0)
                                break;
                        nl_dump_check_consistent(cb, nlmsg_hdr(skb));
                }
                                                  cb->nlh->nlmsg_seq,
                                                  RTM_GETMULTICAST,
                                                  NLM_F_MULTI);
-                       if (err <= 0)
+                       if (err < 0)
                                break;
                }
                break;
                                                  cb->nlh->nlmsg_seq,
                                                  RTM_GETANYCAST,
                                                  NLM_F_MULTI);
-                       if (err <= 0)
+                       if (err < 0)
                                break;
                }
                break;
                goto nla_put_failure;
 
        nla_nest_end(skb, protoinfo);
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
                        if (inet6_fill_ifinfo(skb, idev,
                                              NETLINK_CB(cb->skb).portid,
                                              cb->nlh->nlmsg_seq,
-                                             RTM_NEWLINK, NLM_F_MULTI) <= 0)
+                                             RTM_NEWLINK, NLM_F_MULTI) < 0)
                                goto out;
 cont:
                        idx++;
        ci.valid_time = ntohl(pinfo->valid);
        if (nla_put(skb, PREFIX_CACHEINFO, sizeof(ci), &ci))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                return -EMSGSIZE;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb)
                                              cb->nlh->nlmsg_seq,
                                              RTM_NEWADDRLABEL,
                                              NLM_F_MULTI);
-                       if (err <= 0)
+                       if (err < 0)
                                break;
                }
                idx++;
 
                        w->leaf = rt;
                        return 1;
                }
-               WARN_ON(res == 0);
        }
        w->leaf = NULL;
        return 0;
 
        if (err < 0 && err != -ENOENT)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, rt->dst.error) < 0)
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
        }
 
 out:
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
 
                if (l2tp_nl_tunnel_send(skb, NETLINK_CB(cb->skb).portid,
                                        cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                       tunnel, L2TP_CMD_TUNNEL_GET) <= 0)
+                                       tunnel, L2TP_CMD_TUNNEL_GET) < 0)
                        goto out;
 
                ti++;
                goto nla_put_failure;
        nla_nest_end(skb, nest);
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(skb, hdr);
 
                if (l2tp_nl_session_send(skb, NETLINK_CB(cb->skb).portid,
                                         cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                        session, L2TP_CMD_SESSION_GET) <= 0)
+                                        session, L2TP_CMD_SESSION_GET) < 0)
                        break;
 
                si++;
 
        if (ip_vs_genl_fill_service(skb, svc) < 0)
                goto nla_put_failure;
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
        if (ip_vs_genl_fill_dest(skb, dest) < 0)
                goto nla_put_failure;
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
        if (ip_vs_genl_fill_daemon(skb, state, mcast_ifn, syncid))
                goto nla_put_failure;
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
 
            nla_put_be32(skb, NFTA_TABLE_USE, htonl(table->use)))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
        if (nla_put_be32(skb, NFTA_CHAIN_USE, htonl(chain->use)))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
            nla_put(skb, NFTA_RULE_USERDATA, rule->ulen, nft_userdata(rule)))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
                goto nla_put_failure;
        nla_nest_end(skb, desc);
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
 
        nla_nest_end(skb, nest);
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
        if (nla_put_be32(skb, NFTA_GEN_ID, htonl(net->nft.base_seq)))
                goto nla_put_failure;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_trim(skb, nlh);
 
        if (ret_val != 0)
                goto listall_cb_failure;
 
-       return genlmsg_end(cb_arg->skb, data);
+       genlmsg_end(cb_arg->skb, data);
+       return 0;
 
 listall_cb_failure:
        genlmsg_cancel(cb_arg->skb, data);
 
                goto listall_cb_failure;
 
        cb_arg->seq++;
-       return genlmsg_end(cb_arg->skb, data);
+       genlmsg_end(cb_arg->skb, data);
+       return 0;
 
 listall_cb_failure:
        genlmsg_cancel(cb_arg->skb, data);
        if (ret_val != 0)
                goto protocols_cb_failure;
 
-       return genlmsg_end(skb, data);
+       genlmsg_end(skb, data);
+       return 0;
 
 protocols_cb_failure:
        genlmsg_cancel(skb, data);
 
                goto list_cb_failure;
 
        cb_arg->seq++;
-       return genlmsg_end(cb_arg->skb, data);
+       genlmsg_end(cb_arg->skb, data);
+       return 0;
 
 list_cb_failure:
        genlmsg_cancel(cb_arg->skb, data);
 
            sk_diag_put_rings_cfg(sk, skb))
                goto out_nlmsg_trim;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 out_nlmsg_trim:
        nlmsg_cancel(skb, nlh);
 
                nla_nest_end(skb, nla_grps);
        }
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
        nla_nest_end(skb, nest);
        nla_nest_end(skb, nla_grps);
 
-       return genlmsg_end(skb, hdr);
+       genlmsg_end(skb, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, hdr);
 
                        goto nla_put_failure;
        }
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(msg, hdr);
            nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(msg, hdr);
            nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux)))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
 
                    nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type))
                        goto nla_put_failure;
 
-               if (genlmsg_end(msg, hdr) < 0)
-                       goto nla_put_failure;
+               genlmsg_end(msg, hdr);
        }
 
        return 0;
 
        if (err)
                goto error;
 
-       return genlmsg_end(skb, ovs_header);
+       genlmsg_end(skb, ovs_header);
+       return 0;
 
 error:
        genlmsg_cancel(skb, ovs_header);
        if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features))
                goto nla_put_failure;
 
-       return genlmsg_end(skb, ovs_header);
+       genlmsg_end(skb, ovs_header);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(skb, ovs_header);
        if (err == -EMSGSIZE)
                goto error;
 
-       return genlmsg_end(skb, ovs_header);
+       genlmsg_end(skb, ovs_header);
+       return 0;
 
 nla_put_failure:
        err = -EMSGSIZE;
 
                                     PACKET_DIAG_FILTER))
                goto out_nlmsg_trim;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 out_nlmsg_trim:
        nlmsg_cancel(skb, nlh);
 
        ifm->ifa_index = dev->ifindex;
        if (nla_put_u8(skb, IFA_LOCAL, addr))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
        if (nla_put_u8(skb, RTA_DST, dst) ||
            nla_put_u32(skb, RTA_OIF, dev->ifindex))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
 
                if (addr_idx++ < addr_start_idx)
                        continue;
-               if (fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid,
-                               cb->nlh->nlmsg_seq, RTM_NEWROUTE))
-                       goto out;
+               fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid,
+                          cb->nlh->nlmsg_seq, RTM_NEWROUTE);
+               /* fill_route() used to return > 0 (or negative errors) but
+                * never 0 - ignore the return value and just go out to
+                * call dumpit again from outside to preserve the behavior
+                */
+               goto out;
        }
 
 out:
 
        if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown))
                goto out_nlmsg_trim;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 out_nlmsg_trim:
        nlmsg_cancel(skb, nlh);
 
                break;
        }
  finish:
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
                        goto nla_put_failure;
        }
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
                    sinfo->assoc_req_ies))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
 
        nla_nest_end(msg, pinfoattr);
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
            nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
 nla_put_failure:
        genlmsg_cancel(msg, hdr);
 
        nla_nest_end(msg, bss);
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  fail_unlock_rcu:
        rcu_read_unlock();
 
        nla_nest_end(msg, infoattr);
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
        /* ignore errors and send incomplete event anyway */
        nl80211_add_scan_req(msg, rdev);
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
            nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex))
                goto nla_put_failure;
 
-       return genlmsg_end(msg, hdr);
+       genlmsg_end(msg, hdr);
+       return 0;
 
  nla_put_failure:
        genlmsg_cancel(msg, hdr);
 
                return err;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_set_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
                return err;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (err)
                goto out_cancel;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 out_cancel:
        nlmsg_cancel(skb, nlh);
                        goto out_cancel;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 out_cancel:
        nlmsg_cancel(skb, nlh);
        if (err)
                return err;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_exp_state_notify(struct xfrm_state *x, const struct km_event *c)
                return err;
        }
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
        }
        upe->hard = !!hard;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c)
                        return err;
                }
        }
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_send_report(struct net *net, u8 proto,
        um->old_sport = x->encap->encap_sport;
        um->reqid = x->props.reqid;
 
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 }
 
 static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,