adf: Zero out the mapping data

The adf_device_post_nocopy function eventually calls the
dma_buf_attach and dma_buf_map_attachment functions. If the
dma_buf_attach function succeeds but the dma_buf_map_attachment
function fails, both the adf_buffer_map function and the
adf_device_post_nocopy function will call the dma_buf_detach
function to tear down the same dma-buf attachment.

b/28447556
Change-Id: I8eb40486496fe2a2ae5dfa1be4b76a4af0d6b827
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
This commit is contained in:
Dennis Cagle 2016-08-01 11:48:04 -07:00 committed by Gerrit - the friendly Code Review server
parent 1190be6997
commit 54d0ee10d8
1 changed files with 3 additions and 1 deletions

View File

@ -305,8 +305,10 @@ static int adf_buffer_map(struct adf_device *dev, struct adf_buffer *buf,
}
done:
if (ret < 0)
if (ret < 0) {
adf_buffer_mapping_cleanup(mapping, buf);
memset(mapping, 0, sizeof(*mapping));
}
return ret;
}