Commit 789c76fa authored by Federico Vaga's avatar Federico Vaga

sw:fw: avoid NULL pointer usage

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 11c33316
......@@ -80,7 +80,7 @@ static int trtl_fw_buffer(struct trtl_fw_msg *msg_i, struct trtl_fw_msg *msg_o)
struct trtl_fw_buffer *buf;
unsigned int offset = 0, index, size;
uint32_t *din;
uint32_t *dout;
uint32_t *dout = NULL;
if (!HAS_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE) {
return -EPERM;
......@@ -122,9 +122,11 @@ static int trtl_fw_buffer(struct trtl_fw_msg *msg_i, struct trtl_fw_msg *msg_o)
memcpy(buf->buf, &din[offset + 2], size);
/* After a set we always read back => get */
case TRTL_MSG_ID_BUF_GET:
dout[offset + 0] = index;
dout[offset + 1] = size;
memcpy(&dout[offset + 2], buf->buf, size);
if (dout) {
dout[offset + 0] = index;
dout[offset + 1] = size;
memcpy(&dout[offset + 2], buf->buf, size);
}
break;
default:
return -EINVAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment