dev: add change_max_rx_frame_size capability

Type: improvement
Change-Id: I922e216818b78f2fe7689c21a1d27d74a0ae28b8
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/dev/dev.c b/src/vnet/dev/dev.c
index bedc7fb..9b99fe4 100644
--- a/src/vnet/dev/dev.c
+++ b/src/vnet/dev/dev.c
@@ -92,14 +92,18 @@
   if ((rv = bus->ops.device_open (vm, dev)) != VNET_DEV_OK)
     return rv;
 
-  if ((rv = dev->ops.alloc (vm, dev)) != VNET_DEV_OK)
+  if (dev->ops.alloc)
     {
-      log_err (dev, "device init failed [rv %d]", rv);
-      if (dev->ops.deinit)
-	dev->ops.deinit (vm, dev);
-      if (dev->ops.free)
-	dev->ops.free (vm, dev);
-      return rv;
+      rv = dev->ops.alloc (vm, dev);
+      if (rv != VNET_DEV_OK)
+	{
+	  log_err (dev, "device init failed [rv %d]", rv);
+	  if (dev->ops.deinit)
+	    dev->ops.deinit (vm, dev);
+	  if (dev->ops.free)
+	    dev->ops.free (vm, dev);
+	  return rv;
+	}
     }
 
   if ((rv = dev->ops.init (vm, dev)) != VNET_DEV_OK)