]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/link-mso19/protocol.c
Fix #442 by renaming sr_dev_driver.priv to .context
[libsigrok.git] / src / hardware / link-mso19 / protocol.c
index 5f7aa719876b11c9bd0eab0096f90e5a8d9102f2..ca85ffaf60dfd920599446b9fe42871430bfedbc 100644 (file)
@@ -30,7 +30,6 @@ static const char mso_head[] = { 0x40, 0x4c, 0x44, 0x53, 0x7e };
 static const char mso_foot[] = { 0x7e };
 
 extern SR_PRIV struct sr_dev_driver link_mso19_driver_info;
-static struct sr_dev_driver *di = &link_mso19_driver_info;
 
 SR_PRIV int mso_send_control_message(struct sr_serial_dev_inst *serial,
                                     uint16_t payload[], int n)
@@ -43,11 +42,7 @@ SR_PRIV int mso_send_control_message(struct sr_serial_dev_inst *serial,
        if (serial->fd < 0)
                goto ret;
 
-       if (!(buf = g_try_malloc(s))) {
-               sr_err("Failed to malloc message buffer.");
-               ret = SR_ERR_MALLOC;
-               goto ret;
-       }
+       buf = g_malloc(s);
 
        p = buf;
        memcpy(p, mso_head, sizeof(mso_head));
@@ -341,7 +336,7 @@ SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t *info)
 
        sr_dbg("Requesting trigger state.");
        ret = mso_send_control_message(serial, ARRAY_AND_SIZE(ops));
-       if (info == NULL || ret != SR_OK)
+       if (!info || ret != SR_OK)
                return ret;
 
        uint8_t buf = 0;
@@ -362,7 +357,7 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data)
        GSList *l;
        int i;
 
-       struct drv_context *drvc = di->priv;
+       struct drv_context *drvc = di->context;
 
        /* Find this device's devc struct by its fd. */
        struct dev_context *devc = NULL;