summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-01-28 21:28:32 +0100
committerThomas Haller <thaller@redhat.com>2022-01-29 16:26:02 +0100
commit748feaee892cb9e2a334237ee1893ab0aaea4153 (patch)
tree62040cd02713acb4bacfe34192b64048f898a9f2
parentc0f9925de85de9590923488d9249b15bd65e8615 (diff)
device/wwan: use cleanup macro in get_capabilities()
-rw-r--r--src/core/devices/wwan/nm-modem-broadband.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/devices/wwan/nm-modem-broadband.c b/src/core/devices/wwan/nm-modem-broadband.c
index 81f090c611..a5d990cf94 100644
--- a/src/core/devices/wwan/nm-modem-broadband.c
+++ b/src/core/devices/wwan/nm-modem-broadband.c
@@ -199,10 +199,11 @@ get_capabilities(NMModem *_self,
NMDeviceModemCapabilities *modem_caps,
NMDeviceModemCapabilities *current_caps)
{
- NMModemBroadband *self = NM_MODEM_BROADBAND(_self);
- MMModemCapability all_supported = MM_MODEM_CAPABILITY_NONE;
- MMModemCapability *supported;
- guint n_supported;
+ NMModemBroadband *self = NM_MODEM_BROADBAND(_self);
+ MMModemCapability all_supported = MM_MODEM_CAPABILITY_NONE;
+ gs_free MMModemCapability *supported = NULL;
+ guint n_supported;
+ guint i;
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_POTS == (guint64) NM_DEVICE_MODEM_CAPABILITY_POTS);
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_CDMA_EVDO
@@ -214,12 +215,8 @@ get_capabilities(NMModem *_self,
/* For now, we don't care about the capability combinations, just merge all
* combinations in a single mask */
if (mm_modem_get_supported_capabilities(self->_priv.modem_iface, &supported, &n_supported)) {
- guint i;
-
for (i = 0; i < n_supported; i++)
all_supported |= supported[i];
-
- g_free(supported);
}
*modem_caps = (NMDeviceModemCapabilities) all_supported;