X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flink-mso19%2Fprotocol.c;h=69551fe0f8244360ae7a3ebac6787f26ae568695;hb=a078d3ec527c0a8180f59086e62a8905ae79aa65;hp=fafd83c3b93b7a15a3488496d4600da9b737e9d3;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git
diff --git a/src/hardware/link-mso19/protocol.c b/src/hardware/link-mso19/protocol.c
index fafd83c3..69551fe0 100644
--- a/src/hardware/link-mso19/protocol.c
+++ b/src/hardware/link-mso19/protocol.c
@@ -19,6 +19,7 @@
* along with this program. If not, see .
*/
+#include
#include "protocol.h"
/* serial protocol */
@@ -42,11 +43,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));
@@ -202,7 +199,7 @@ SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val)
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
}
-SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context * devc)
+SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc)
{
return (uint16_t) (0x200 -
((devc->dso_trigger_voltage / devc->dso_probe_attn) /
@@ -340,7 +337,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;
@@ -361,7 +358,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;