diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 3431aaf6a91d6c84a682eb95a0ae1bddf8fe77bf..ff86aa1fc9b66f1038eff989d1549d08792fd5a1 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -3146,9 +3146,7 @@ virNetDevSwitchdevFeature(const char *ifname, int is_vf = -1; int ret = -1; uint32_t family_id; - - if (virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id) <= 0) - return ret; + int rv; if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0) return ret; @@ -3168,6 +3166,9 @@ virNetDevSwitchdevFeature(const char *ifname, goto cleanup; } + if ((rv = virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id)) <= 0) + return rv; + if (!(nl_msg = nlmsg_alloc_simple(family_id, NLM_F_REQUEST | NLM_F_ACK))) { virReportOOMError();