From 33467f9a0952ebfee1faf3aba9fdef8b42b9d5c5 Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Mon, 4 Jun 2018 15:57:00 -0700 Subject: goldfish: pipe: ANDROID: remove redundant blank lines Bug: 72717639 Change-Id: I951c34c7247c764ccd40a3e62680909b76403c4c Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe_v2.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/platform') diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c b/drivers/platform/goldfish/goldfish_pipe_v2.c index 90bac4b055a3..7a53b6b4072d 100644 --- a/drivers/platform/goldfish/goldfish_pipe_v2.c +++ b/drivers/platform/goldfish/goldfish_pipe_v2.c @@ -996,7 +996,6 @@ static int goldfish_dma_mmap_locked( dma->phys_begin >> PAGE_SHIFT, sz_requested, vma->vm_page_prot); - if (status < 0) { dev_err(pdev_dev, "Cannot remap pfn range....\n"); return -EAGAIN; @@ -1025,7 +1024,6 @@ static int goldfish_dma_mmap(struct file *filp, struct vm_area_struct *vma) status = goldfish_dma_mmap_locked(pipe, vma); mutex_unlock(&pipe->lock); return status; - } static int goldfish_pipe_dma_create_region( -- cgit v1.2.3 From 6cdd987da8a5b293d83e4cd8b168ad1e3b7bc0a7 Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Mon, 4 Jun 2018 18:22:58 -0700 Subject: goldfish: pipe: ANDROID: add missing check for memory allocated Bug: 72717639 Change-Id: I9bc8db41f2269c38a259d842ea52bdc0037f3bae Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/platform') diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c b/drivers/platform/goldfish/goldfish_pipe_v2.c index 7a53b6b4072d..a904e66c6641 100644 --- a/drivers/platform/goldfish/goldfish_pipe_v2.c +++ b/drivers/platform/goldfish/goldfish_pipe_v2.c @@ -951,7 +951,8 @@ static int goldfish_pipe_dma_alloc_locked(struct goldfish_pipe *pipe) dma->dma_size, &dma->phys_begin, GFP_KERNEL); - return -ENOMEM; + if (!dma->dma_vaddr) + return -ENOMEM; dma->phys_end = dma->phys_begin + dma->dma_size; pipe->dev->dma_alloc_total += dma->dma_size; -- cgit v1.2.3 From 7e3a6fc483350235bf3446492133d60c292d487c Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Mon, 4 Jun 2018 18:25:35 -0700 Subject: goldfish: pipe: ANDROID: address must be written as __pa(x), not x The previous change missed the __pa transformation applied to the address before passing it further. The value also has to be written from the high part first. Bug: 72717639 Change-Id: Id0756ca733f26ced1d74179764116db05ec47bea Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe_v2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/platform') diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c b/drivers/platform/goldfish/goldfish_pipe_v2.c index a904e66c6641..f0b9b46047be 100644 --- a/drivers/platform/goldfish/goldfish_pipe_v2.c +++ b/drivers/platform/goldfish/goldfish_pipe_v2.c @@ -1153,6 +1153,15 @@ static struct miscdevice goldfish_pipe_miscdev = { .fops = &goldfish_pipe_fops, }; + +static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth) +{ + const unsigned long paddr = __pa(addr); + + writel(paddr >> 32, porth); + writel((u32)paddr, portl); +} + static int goldfish_pipe_device_init_v2(struct platform_device *pdev) { struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; @@ -1196,14 +1205,14 @@ static int goldfish_pipe_device_init_v2(struct platform_device *pdev) dev->buffers = (struct goldfish_pipe_dev_buffers *)page; /* Send the buffer addresses to the host */ - gf_write_ptr(&dev->buffers->signalled_pipe_buffers, + write_pa_addr(&dev->buffers->signalled_pipe_buffers, dev->base + PIPE_REG_SIGNAL_BUFFER, dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH); writel((u32)MAX_SIGNALLED_PIPES, dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT); - gf_write_ptr(&dev->buffers->open_command_params, + write_pa_addr(&dev->buffers->open_command_params, dev->base + PIPE_REG_OPEN_BUFFER, dev->base + PIPE_REG_OPEN_BUFFER_HIGH); -- cgit v1.2.3