[ovs-dev] [port-renumbering 5/8] netdev: Log a warning when netdev_set_config() fails.

Ben Pfaff blp at nicira.com
Wed Dec 11 18:50:37 UTC 2013


On Wed, Dec 11, 2013 at 10:24:50AM -0800, Jarno Rajahalme wrote:
> 
> On Dec 10, 2013, at 11:20 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > This allows its callers to avoid duplicating the code.
> > 
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > lib/netdev.c          |   10 ++++++++--
> > utilities/ovs-dpctl.c |    2 --
> > vswitchd/bridge.c     |    9 +--------
> > 3 files changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/lib/netdev.c b/lib/netdev.c
> > index 5ed6062..159ca51 100644
> > --- a/lib/netdev.c
> > +++ b/lib/netdev.c
> > @@ -386,8 +386,14 @@ netdev_set_config(struct netdev *netdev, const struct smap *args)
> > {
> >     if (netdev->netdev_class->set_config) {
> >         const struct smap no_args = SMAP_INITIALIZER(&no_args);
> > -        return netdev->netdev_class->set_config(netdev,
> > -                                                args ? args : &no_args);
> > +        int error;
> > +
> > +        error = netdev->netdev_class->set_config(netdev,
> > +                                                 args ? args : &no_args);
> > +        if (error) {
> > +            VLOG_WARN("%s: could not set configuration (%s)",
> > +                      netdev_get_name(netdev), ovs_strerror(error));
> > +        }
> 
> Wouldn?t you still want to return the error? The callers seem to expect it.

Yes, good point, sorry.  I added a "return error;" here.

> Otherwise:
> 
> Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

Thanks!



More information about the dev mailing list