All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: <netdev@vger.kernel.org>, <xen-devel@lists.xenproject.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH net-next v1] xen-netback: implement dynamic multicast control
Date: Tue, 2 Feb 2016 11:08:37 +0000	[thread overview]
Message-ID: <20160202110837.GY25660@citrix.com> (raw)
In-Reply-To: <1454337653-8517-1-git-send-email-paul.durrant@citrix.com>

On Mon, Feb 01, 2016 at 02:40:53PM +0000, Paul Durrant wrote:
[...]
> +static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
> +					 struct xenvif *vif)
> +{
> +	int err = 0;
> +	char *node;
> +	unsigned maxlen = strlen(dev->otherend) +
> +		sizeof("/request-multicast-control");
> +
> +	if (vif->mcast_ctrl_watch.node)
> +		return -EADDRINUSE;
> +
> +	node = kmalloc(maxlen, GFP_KERNEL);
> +	if (!node)
> +		return -ENOMEM;

This is one error path that has no logging, so please either add logging
in each error patch ...

> +	snprintf(node, maxlen, "%s/request-multicast-control",
> +		 dev->otherend);
> +	vif->mcast_ctrl_watch.node = node;
> +	vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed;
> +	err = register_xenbus_watch(&vif->mcast_ctrl_watch);
> +	if (err) {
> +		pr_err("Failed to set watcher %s\n",
> +		       vif->mcast_ctrl_watch.node);
> +		kfree(node);
> +		vif->mcast_ctrl_watch.node = NULL;
> +		vif->mcast_ctrl_watch.callback = NULL;
> +	}
> +	return err;
> +}
> +
> +static void xen_unregister_mcast_ctrl_watch(struct xenvif *vif)
> +{
> +	if (vif->mcast_ctrl_watch.node) {
> +		unregister_xenbus_watch(&vif->mcast_ctrl_watch);
> +		kfree(vif->mcast_ctrl_watch.node);
> +		vif->mcast_ctrl_watch.node = NULL;
> +	}
> +}
> +
> +static void xen_register_watchers(struct xenbus_device *dev,
> +				  struct xenvif *vif)
> +{
> +	xen_register_credit_watch(dev, vif);
> +	xen_register_mcast_ctrl_watch(dev, vif);
> +}
> +
> +static void xen_unregister_watchers(struct xenvif *vif)
> +{
> +	xen_unregister_mcast_ctrl_watch(vif);
> +	xen_unregister_credit_watch(vif);
> +}

... or check if these register/unregister function calls' return value
and log if something fails.

Wei.

  reply	other threads:[~2016-02-02 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 14:40 [PATCH net-next v1] xen-netback: implement dynamic multicast control Paul Durrant
2016-02-02 11:08 ` Wei Liu [this message]
2016-02-02 11:15   ` Paul Durrant
2016-02-02 11:15   ` Paul Durrant
2016-02-02 11:08 ` Wei Liu
  -- strict thread matches above, loose matches on Subject: below --
2016-02-01 14:40 Paul Durrant

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=20160202110837.GY25660@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.