From 7eca706751907c498ff27408aa2e0098205c4bf3 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 19 Apr 2016 11:59:36 +0200 Subject: [PATCH] infiniband: check that the connection to be created is a partition first No functional change. It will make it a bit easier to produce a good error message in subsequent commit. --- src/devices/nm-device-infiniband.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 956aac560f..5c61d4766c 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -239,14 +239,8 @@ create_and_realize (NMDevice *device, int parent_ifindex, p_key; NMPlatformError plerr; - if (!NM_IS_DEVICE_INFINIBAND (parent)) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "Parent interface %s must be an InfiniBand interface", - nm_device_get_iface (parent)); - return FALSE; - } - s_infiniband = nm_connection_get_setting_infiniband (connection); + g_assert (s_infiniband); /* Can only create partitions at this time */ p_key = nm_setting_infiniband_get_p_key (s_infiniband); @@ -256,6 +250,13 @@ create_and_realize (NMDevice *device, return FALSE; } + if (!NM_IS_DEVICE_INFINIBAND (parent)) { + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + "Parent interface %s must be an InfiniBand interface", + nm_device_get_iface (parent)); + return FALSE; + } + parent_ifindex = nm_device_get_ifindex (parent); if (parent_ifindex <= 0) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,