/* Stores the features supported by 'netdev' into each of '*current',
* '*advertised', '*supported', and '*peer' that are non-null. Each value is a
* bitmap of "enum ofp_port_features" bits, in host byte order. Returns 0 if
- * successful, otherwise a positive errno value. On failure, all of the
- * passed-in values are set to 0. */
+ * successful, otherwise a positive errno value. */
static int
netdev_linux_get_features(struct netdev *netdev,
uint32_t *current, uint32_t *advertised,
uint32_t *supported, uint32_t *peer)
{
uint32_t dummy[4];
- return netdev->class->get_features(netdev,
- current ? current : &dummy[0],
- advertised ? advertised : &dummy[1],
- supported ? supported : &dummy[2],
- peer ? peer : &dummy[3]);
+ int error;
+
+ if (!current) {
+ current = &dummy[0];
+ }
+ if (!advertised) {
+ advertised = &dummy[1];
+ }
+ if (!supported) {
+ supported = &dummy[2];
+ }
+ if (!peer) {
+ peer = &dummy[3];
+ }
+
+ error = netdev->class->get_features(netdev, current, advertised, supported,
+ peer);
+ if (error) {
+ *current = *advertised = *supported = *peer = 0;
+ }
+ return error;
}
/* Set the features advertised by 'netdev' to 'advertise'. Returns 0 if