diff options
author | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2012-11-16 00:46:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-21 16:44:10 -0500 |
commit | 24fce61b0b7f1bc94970036db1f1d65b0770d168 (patch) | |
tree | f782abab57d4152c60e44cd54679d311518c2f8b /drivers/uio | |
parent | 9b96c3124b66a959ba061dbca339944a81686cd2 (diff) |
drivers: uio_dmem_genirq: Don't mix address spaces for dynamic region vaddr
Assigning the virtual address returned from dma_alloc_coherent to the the
internal_addr element of uioinfo produces the following sparse errors since
internal_addr is a void __iomem * and dma_alloc_coherent returns void *.
+ drivers/uio/uio_dmem_genirq.c:65:39: sparse: incorrect type in assignment (different address spaces)
drivers/uio/uio_dmem_genirq.c:65:39: expected void [noderef] <asn:2>*internal_addr
drivers/uio/uio_dmem_genirq.c:65:39: got void *[assigned] addr
+ drivers/uio/uio_dmem_genirq.c:93:17: sparse: incorrect type in argument 3 (different address spaces)
drivers/uio/uio_dmem_genirq.c:93:17: expected void *vaddr
drivers/uio/uio_dmem_genirq.c:93:17: got void [noderef] <asn:2>*internal_addr
Store the void * in the driver's private data instead.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio_dmem_genirq.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 4d4dd008c8b9..d8bbe0783cdc 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c | |||
@@ -37,6 +37,7 @@ struct uio_dmem_genirq_platdata { | |||
37 | struct platform_device *pdev; | 37 | struct platform_device *pdev; |
38 | unsigned int dmem_region_start; | 38 | unsigned int dmem_region_start; |
39 | unsigned int num_dmem_regions; | 39 | unsigned int num_dmem_regions; |
40 | void *dmem_region_vaddr[MAX_UIO_MAPS]; | ||
40 | struct mutex alloc_lock; | 41 | struct mutex alloc_lock; |
41 | unsigned int refcnt; | 42 | unsigned int refcnt; |
42 | }; | 43 | }; |
@@ -46,6 +47,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode) | |||
46 | struct uio_dmem_genirq_platdata *priv = info->priv; | 47 | struct uio_dmem_genirq_platdata *priv = info->priv; |
47 | struct uio_mem *uiomem; | 48 | struct uio_mem *uiomem; |
48 | int ret = 0; | 49 | int ret = 0; |
50 | int dmem_region = priv->dmem_region_start; | ||
49 | 51 | ||
50 | uiomem = &priv->uioinfo->mem[priv->dmem_region_start]; | 52 | uiomem = &priv->uioinfo->mem[priv->dmem_region_start]; |
51 | 53 | ||
@@ -61,8 +63,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode) | |||
61 | ret = -ENOMEM; | 63 | ret = -ENOMEM; |
62 | break; | 64 | break; |
63 | } | 65 | } |
64 | 66 | priv->dmem_region_vaddr[dmem_region++] = addr; | |
65 | uiomem->internal_addr = addr; | ||
66 | ++uiomem; | 67 | ++uiomem; |
67 | } | 68 | } |
68 | priv->refcnt++; | 69 | priv->refcnt++; |
@@ -77,6 +78,7 @@ static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode) | |||
77 | { | 78 | { |
78 | struct uio_dmem_genirq_platdata *priv = info->priv; | 79 | struct uio_dmem_genirq_platdata *priv = info->priv; |
79 | struct uio_mem *uiomem; | 80 | struct uio_mem *uiomem; |
81 | int dmem_region = priv->dmem_region_start; | ||
80 | 82 | ||
81 | /* Tell the Runtime PM code that the device has become idle */ | 83 | /* Tell the Runtime PM code that the device has become idle */ |
82 | pm_runtime_put_sync(&priv->pdev->dev); | 84 | pm_runtime_put_sync(&priv->pdev->dev); |
@@ -91,7 +93,8 @@ static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode) | |||
91 | break; | 93 | break; |
92 | 94 | ||
93 | dma_free_coherent(&priv->pdev->dev, uiomem->size, | 95 | dma_free_coherent(&priv->pdev->dev, uiomem->size, |
94 | uiomem->internal_addr, uiomem->addr); | 96 | priv->dmem_region_vaddr[dmem_region++], |
97 | uiomem->addr); | ||
95 | uiomem->addr = DMA_ERROR_CODE; | 98 | uiomem->addr = DMA_ERROR_CODE; |
96 | ++uiomem; | 99 | ++uiomem; |
97 | } | 100 | } |