linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Patrik Flykt <patrik.flykt@linux.intel.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/2] mac80211-hwsim: Factor out netlink attribute appending
Date: Mon, 10 Nov 2014 10:32:48 +0100	[thread overview]
Message-ID: <1415611968.1847.7.camel@sipsolutions.net> (raw)
In-Reply-To: <1415348520-28558-2-git-send-email-patrik.flykt@linux.intel.com> (sfid-20141107_092208_883031_E35223C8)

On Fri, 2014-11-07 at 10:21 +0200, Patrik Flykt wrote:

> -error:
> -	nlmsg_free(skb);
> -	return NULL;
> +	return 0;
>  }
>  
> -static void hswim_mcast_new_radio(int id, struct genl_info *info,
> +static void hwsim_mcast_new_radio(int id, struct genl_info *info,
>  				  struct hwsim_new_radio_params *param)
>  {
>  	struct sk_buff *mcast_skb;
> +	void *data;
>  
> -	mcast_skb = build_radio_msg(HWSIM_CMD_NEW_RADIO, id, param);
> +	mcast_skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
>  	if (!mcast_skb)
>  		return;
>  
> +	data = genlmsg_put(mcast_skb, 0, 0, &hwsim_genl_family, 0,
> +			   HWSIM_CMD_NEW_RADIO);
> +	if (!data)
> +		goto out_err;
> +
> +	if (append_radio_msg(mcast_skb, id, param) < 0)
> +		goto out_err;
> +
> +	if (genlmsg_end(mcast_skb, data))
> +		goto out_err;
> +
>  	hwsim_mcast_config_msg(mcast_skb, info);
> +	return;
> +
> +out_err:
> +	genlmsg_cancel(mcast_skb, data);
>  }

You seem to have lost the nlmsg_free() in error cases.

johannes


  reply	other threads:[~2014-11-10  9:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  8:21 [PATCH 0/2] Add HWSIM_CMD_GET_RADIO command Patrik Flykt
2014-11-07  8:21 ` [PATCH 1/2] mac80211-hwsim: Factor out netlink attribute appending Patrik Flykt
2014-11-10  9:32   ` Johannes Berg [this message]
2014-11-12 13:08     ` Patrik Flykt
2014-11-07  8:22 ` [PATCH 2/2] mac80211-hwsim: Add HWSIM_CMD_GET_RADIO command Patrik Flykt
2014-11-10  9:34   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415611968.1847.7.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=patrik.flykt@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).