summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-04-19 11:59:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2016-04-19 13:32:28 +0200
commit7eca706751907c498ff27408aa2e0098205c4bf3 (patch)
tree5fac147349b5c10f1a664200a3e12d0999ea5454
parentdda8e24a214a8a1f4057e48b13f1f7af8c01de4f (diff)
downloadNetworkManager-7eca706751907c498ff27408aa2e0098205c4bf3.tar.gz
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.
-rw-r--r--src/devices/nm-device-infiniband.c15
1 files 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,