return -ENOMEM;
vdm_tx->data[0] = vdm_hdr;
- memcpy(&vdm_tx->data[1], vdos, num_vdos * sizeof(u32));
+ if (vdos && num_vdos)
+ memcpy(&vdm_tx->data[1], vdos, num_vdos * sizeof(u32));
vdm_tx->size = num_vdos + 1; /* include the header */
/* VDM will get sent in PE_SRC/SNK_READY state handling */
dev_dbg(pdphy->dev, "%s: hdr %x frame type %d timeout %u\n",
__func__, hdr, type, timeout_ms);
- print_hex_dump_debug("tx data obj:", DUMP_PREFIX_NONE, 32, 4,
- data, data_len, false);
+
+ if (data && data_len)
+ print_hex_dump_debug("tx data obj:", DUMP_PREFIX_NONE, 32, 4,
+ data, data_len, false);
if (!pdphy) {
pr_err("%s: pdphy not found\n", __func__);
if (ret)
return ret;
- if (data_len) {
+ if (data && data_len) {
/* write data objects of SOP message */
ret = pdphy_bulk_reg_write(pdphy, USB_PDPHY_TX_BUFFER_DATA,
data, data_len);