unsigned char buf[4096];
sr_info("Uploading firmware at %s", filename);
- if ((fw = g_fopen(filename, "rb")) == NULL) {
+ if (!(fw = g_fopen(filename, "rb"))) {
sr_err("Unable to open firmware file %s for reading: %s",
filename, strerror(errno));
return SR_ERR;
* Let's assume there's no ACME device present if no probe
* has been registered.
*/
- if (sdi->channel_groups == NULL)
+ if (!sdi->channel_groups)
goto err_out;
devices = g_slist_append(devices, sdi);
if (devc->limit_samples > 0)
pre_trigger_samples = devc->capture_ratio * devc->limit_samples/100;
devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
- if (devc->stl == NULL)
+ if (!devc->stl)
return SR_ERR_MALLOC;
devc->trigger_fired = FALSE;
} else
struct sr_usb_dev_inst *usb;
usb = sdi->conn;
- if (usb->devhdl == NULL)
+ if (!usb->devhdl)
return SR_ERR;
sr_info("fx2lafw: Closing device on %d.%d (logical) / %s (physical) interface %d.",
if (devc->limit_samples > 0)
pre_trigger_samples = devc->capture_ratio * devc->limit_samples/100;
devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
- if (devc->stl == NULL)
+ if (!devc->stl)
return SR_ERR_MALLOC;
devc->trigger_fired = FALSE;
} else
}
buf = g_malloc(FW_BUFSIZE);
- if ((fw = g_fopen(filename, "rb")) == NULL) {
+ if (!(fw = g_fopen(filename, "rb"))) {
sr_err("Unable to open %s for reading: %s.", filename, strerror(errno));
return SR_ERR;
}
usb = sdi->conn;
- if (usb->devhdl == NULL)
+ if (!usb->devhdl)
return;
sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, USB_VID_PID);
- if (usb_devices == NULL)
+ if (!usb_devices)
return NULL;
for (l = usb_devices; l; l = l->next) {
}
if (!conn)
conn = SERIALCONN;
- if (serialcomm == NULL)
+ if (!serialcomm)
serialcomm = SERIALCOMM;
udev = udev_new();
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;
if (!conn)
return NULL;
- if (serialcomm == NULL)
+ if (!serialcomm)
serialcomm = SERIALCOMM;
serial = sr_serial_dev_inst_new(conn, serialcomm);
struct sr_usb_dev_inst *usb;
usb = sdi->conn;
- if (usb->devhdl == NULL)
+ if (!usb->devhdl)
return SR_ERR;
sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
if (devc->limit_samples > 0)
pre_trigger_samples = devc->capture_ratio * devc->limit_samples/100;
devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
- if (devc->stl == NULL)
+ if (!devc->stl)
return SR_ERR_MALLOC;
devc->trigger_fired = FALSE;
} else
usb = sdi->conn;
if (cmd_len < 1 || cmd_len > 64 || reply_len > 64 ||
- command == NULL || (reply_len > 0 && reply == NULL))
+ !command || (reply_len > 0 && !reply))
return SR_ERR_ARG;
encrypt(buf, command, cmd_len);
uint8_t chunk, command[64];
int ret;
- if (cnt < 1 || cnt + offset > 64 || table == NULL)
+ if (cnt < 1 || cnt + offset > 64 || !table)
return SR_ERR_ARG;
while (cnt > 0) {
}
sr_info("Uploading FPGA bitstream at %s.", filename);
- if ((fw = g_fopen(filename, "rb")) == NULL) {
+ if (!(fw = g_fopen(filename, "rb"))) {
sr_err("Unable to open bitstream file %s for reading: %s.",
filename, strerror(errno));
return SR_ERR;
(void)drvc;
for (i = 0; i < ARRAY_SIZE(scpi_serial_usb_ids); i++) {
- if ((l = sr_serial_find_usb(scpi_serial_usb_ids[i].vendor_id,
- scpi_serial_usb_ids[i].product_id)) == NULL)
+ if (!(l = sr_serial_find_usb(scpi_serial_usb_ids[i].vendor_id,
+ scpi_serial_usb_ids[i].product_id)))
continue;
for (r = l; r; r = r->next) {
if (scpi_serial_usb_ids[i].serialcomm)
Create_LinkResp *link_resp;
vxi->client = clnt_create(vxi->address, DEVICE_CORE, DEVICE_CORE_VERSION, "tcp");
- if (vxi->client == NULL) {
+ if (!vxi->client) {
sr_err("Client creation failed for %s", vxi->address);
return SR_ERR;
}
stl->pre_trigger_buffer = g_malloc(stl->pre_trigger_size);
stl->pre_trigger_head = stl->pre_trigger_buffer;
- if (stl->pre_trigger_size > 0 && stl->pre_trigger_buffer == NULL) {
+ if (stl->pre_trigger_size > 0 && !stl->pre_trigger_buffer) {
soft_trigger_logic_free(stl);
return NULL;
}
const char *p, prefix[] = "\0kMGTPE";
char fmt[16], fract[20] = "", *f;
- if (unit == NULL)
+ if (!unit)
unit = "";
for (i = 0; (quot = x / divisor[i]) >= 1000; i++);