* 2) didn't find the XDS110, and no devices are currently open
*/
- if (NULL != list) {
+ if (list) {
/* Free the device list, we're done with it */
libusb_free_device_list(list, 1);
}
/* On an error, clean up what we can */
if (0 != result) {
- if (NULL != dev) {
+ if (dev) {
/* Release the debug and data interface on the XDS110 */
(void)libusb_release_interface(dev, xds110.interface);
libusb_close(dev);
}
- if (NULL != ctx)
+ if (ctx)
libusb_exit(ctx);
xds110.ctx = NULL;
xds110.dev = NULL;
static void usb_disconnect(void)
{
- if (NULL != xds110.dev) {
+ if (xds110.dev) {
/* Release the debug and data interface on the XDS110 */
(void)libusb_release_interface(xds110.dev, xds110.interface);
libusb_close(xds110.dev);
xds110.dev = NULL;
}
- if (NULL != xds110.ctx) {
+ if (xds110.ctx) {
libusb_exit(xds110.ctx);
xds110.ctx = NULL;
}
retries++;
}
- if (NULL != written)
+ if (written)
*written = bytes_written;
return (result == 0 && size == bytes_written) ? true : false;
/* Abort now if we didn't receive a valid response */
if (!success) {
- if (NULL != total_bytes_read)
+ if (total_bytes_read)
*total_bytes_read = 0;
return false;
}
if (!success)
count = 0;
- if (NULL != total_bytes_read)
+ if (total_bytes_read)
*total_bytes_read = count;
return success;
int error = 0;
uint32_t bytes_read = 0;
- if (NULL == xds110.dev)
+ if (!xds110.dev)
return false;
while (!done && attempts > 0) {
DEFAULT_TIMEOUT);
if (success) {
- if (NULL != firmware_id)
+ if (firmware_id)
*firmware_id = xds110_get_u32(fw_id_pntr);
- if (NULL != hardware_id)
+ if (hardware_id)
*hardware_id = xds110_get_u16(hw_id_pntr);
}
DEFAULT_TIMEOUT);
if (success) {
- if (NULL != idcode)
+ if (idcode)
*idcode = xds110_get_u32(idcode_pntr);
}
DEFAULT_TIMEOUT);
if (success) {
- if (NULL != value)
+ if (value)
*value = xds110_get_u32(value_pntr);
}
bool success;
- if (NULL == value)
+ if (!value)
return false;
xds110.write_payload[0] = CMAPI_REG_WRITE;
bool success;
- if (NULL == path)
+ if (!path)
return false;
xds110.write_payload[0] = OCD_PATHMOVE;
/* Handle result of read attempt */
if (!success)
LOG_ERROR("XDS110: failed to read DAP register");
- else if (NULL != value)
+ else if (value)
*value = reg_value;
if (success && DAP_AP == type) {
{
struct jtag_command *cmd = jtag_command_queue;
- while (cmd != NULL) {
+ while (cmd) {
xds110_execute_command(cmd);
cmd = cmd->next;
}