> -----Original Message-----
> From: Wei Liu [mailto:[email protected]]
> Sent: 02 February 2016 11:09
> To: Paul Durrant
> Cc: [email protected]; [email protected]; Ian Campbell;
> Wei Liu
> Subject: Re: [PATCH net-next v1] xen-netback: implement dynamic multicast
> control
>
> 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 ...
>
Sure.
> > + 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.
>
Given that the similar failure path in credit watch registration never logged
adding a check here may create noise where there was none before.
Paul
> Wei.