diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-15 22:56:12 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-15 23:24:50 +0200 |
commit | af756a1bf7d8005f7bb4d7bfcccf5133ce57b54d (patch) | |
tree | 1399a9a42a71e83fe9254935c9be34eb4f8de13f | |
parent | 7711e84af9354d1dfee64674a3e928d13586d5b1 (diff) |
port-qmi: avoid running install_properties() without properties defined
We'll setup the properties only if QRTR support is being built,
otherwise we fully skip all property related setup.
(ModemManager:480463): GLib-GObject-CRITICAL **: 22:48:14.264: g_object_class_install_properties: assertion 'n_pspecs > 1' failed
Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff76e3295 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff76e3295 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007ffff76e4579 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff76e4743 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00005555556af70c in mm_port_qmi_class_init (klass=0x5555557fae20) at mm-port-qmi.c:2619
#4 0x00005555556a94c3 in mm_port_qmi_class_intern_init (klass=0x5555557fae20) at mm-port-qmi.c:34
#5 0x00007ffff77ed1d1 in g_type_class_ref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff77d05e1 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x00007ffff77d06cd in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00005555556af25a in mm_port_qmi_new (name=0x5555557e54e0 "cdc-wdm0", subsys=MM_PORT_SUBSYS_USBMISC) at mm-port-qmi.c:2481
#9 0x000055555563c8d7 in wdm_probe_qmi (self=0x5555557de1b0) at mm-port-probe.c:517
#10 0x000055555563cc70 in wdm_probe (self=0x5555557de1b0) at mm-port-probe.c:623
#11 0x00007ffff76dd04e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007ffff76dd400 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff76dd6f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00005555555b1ae4 in main (argc=1, argv=0x7fffffffe558) at main.c:213
-rw-r--r-- | src/mm-port-qmi.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c index d6779be9..ababc305 100644 --- a/src/mm-port-qmi.c +++ b/src/mm-port-qmi.c @@ -33,16 +33,18 @@ G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT) +#if defined WITH_QRTR + enum { PROP_0, -#if defined WITH_QRTR PROP_NODE, -#endif PROP_LAST }; static GParamSpec *properties[PROP_LAST]; +#endif + typedef struct { QmiService service; QmiClient *client; @@ -2511,23 +2513,21 @@ mm_port_qmi_init (MMPortQmi *self) NULL); } +#if defined WITH_QRTR + static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { + MMPortQmi *self = MM_PORT_QMI (object); + switch (prop_id) { -#if defined WITH_QRTR case PROP_NODE: - { - MMPortQmi *self = MM_PORT_QMI (object); - /* construct only, no new reference! */ self->priv->node = g_value_get_object (value); break; - } -#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2540,22 +2540,20 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { + MMPortQmi *self = MM_PORT_QMI (object); + switch (prop_id) { -#if defined WITH_QRTR case PROP_NODE: - { - MMPortQmi *self = MM_PORT_QMI (object); - g_value_set_object (value, self->priv->node); break; - } -#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } +#endif /* defined WITH_QRTR */ + static void dispose (GObject *object) { @@ -2603,11 +2601,12 @@ mm_port_qmi_class_init (MMPortQmiClass *klass) g_type_class_add_private (object_class, sizeof (MMPortQmiPrivate)); /* Virtual methods */ - object_class->get_property = get_property; - object_class->set_property = set_property; object_class->dispose = dispose; #if defined WITH_QRTR + object_class->get_property = get_property; + object_class->set_property = set_property; + properties[PROP_NODE] = g_param_spec_object ("node", "Qrtr Node", @@ -2615,6 +2614,6 @@ mm_port_qmi_class_init (MMPortQmiClass *klass) QRTR_TYPE_NODE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); -#endif g_object_class_install_properties (object_class, PROP_LAST, properties); +#endif } |