mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
Merge "usb: u_qdss: Add proper error handling in case of mapping failure"
This commit is contained in:
commit
71b6dcd5aa
2 changed files with 32 additions and 3 deletions
|
|
@ -334,9 +334,15 @@ static int usb_bam_alloc_buffer(struct usb_bam_pipe_connect *pipe_connect)
|
|||
memset_io(data_buf->base, 0, data_buf->size);
|
||||
data_buf->iova = dma_map_resource(dev, data_buf->phys_base,
|
||||
data_buf->size, DMA_BIDIRECTIONAL, 0);
|
||||
if (dma_mapping_error(dev, data_buf->iova))
|
||||
if (dma_mapping_error(dev, data_buf->iova)) {
|
||||
log_event_err("%s(): oci_mem: err mapping data_buf\n",
|
||||
__func__);
|
||||
iounmap(data_buf->base);
|
||||
data_buf->base = NULL;
|
||||
ret = -ENOMEM;
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
log_event_dbg("%s: data_buf:%s virt:%pK, phys:%lx, iova:%lx\n",
|
||||
__func__, dev_name(dev), data_buf->base,
|
||||
(unsigned long)data_buf->phys_base, data_buf->iova);
|
||||
|
|
@ -348,7 +354,11 @@ static int usb_bam_alloc_buffer(struct usb_bam_pipe_connect *pipe_connect)
|
|||
if (!desc_buf->base) {
|
||||
log_event_err("%s: ioremap failed for desc fifo\n",
|
||||
__func__);
|
||||
dma_unmap_resource(dev, data_buf->iova,
|
||||
data_buf->size,
|
||||
DMA_BIDIRECTIONAL, 0);
|
||||
iounmap(data_buf->base);
|
||||
data_buf->base = NULL;
|
||||
ret = -ENOMEM;
|
||||
goto err_exit;
|
||||
}
|
||||
|
|
@ -356,9 +366,19 @@ static int usb_bam_alloc_buffer(struct usb_bam_pipe_connect *pipe_connect)
|
|||
desc_buf->iova = dma_map_resource(dev, desc_buf->phys_base,
|
||||
desc_buf->size,
|
||||
DMA_BIDIRECTIONAL, 0);
|
||||
if (dma_mapping_error(dev, desc_buf->iova))
|
||||
if (dma_mapping_error(dev, desc_buf->iova)) {
|
||||
log_event_err("%s(): oci_mem: err mapping desc_buf\n",
|
||||
__func__);
|
||||
dma_unmap_resource(dev, data_buf->iova,
|
||||
data_buf->size,
|
||||
DMA_BIDIRECTIONAL, 0);
|
||||
iounmap(data_buf->base);
|
||||
data_buf->base = NULL;
|
||||
iounmap(desc_buf->base);
|
||||
desc_buf->base = NULL;
|
||||
ret = -ENOMEM;
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
log_event_dbg("%s: desc_buf:%s virt:%pK, phys:%lx, iova:%lx\n",
|
||||
__func__, dev_name(dev), desc_buf->base,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,16 @@ int set_qdss_data_connection(struct f_qdss *qdss, int enable)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
usb_bam_alloc_fifos(usb_bam_type, idx);
|
||||
ret = usb_bam_alloc_fifos(usb_bam_type, idx);
|
||||
if (ret) {
|
||||
pr_err("%s: usb_bam_alloc_fifos failed(%d)\n",
|
||||
__func__, ret);
|
||||
dma_unmap_resource(dev->parent, bam_info.qdss_bam_iova,
|
||||
bam_info.qdss_bam_size,
|
||||
DMA_BIDIRECTIONAL, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bam_info.data_fifo =
|
||||
kzalloc(sizeof(struct sps_mem_buffer), GFP_KERNEL);
|
||||
if (!bam_info.data_fifo) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue