diff options
| author | Vyacheslav V. Yurkov <uvv.mail@gmail.com> | 2016-06-14 03:58:37 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 09:19:55 -0400 |
| commit | 775115c06091fcfa1189a50aca488fa596839617 (patch) | |
| tree | 597917c12f59b657ed1ae8ccc0f612334ea1eccf /drivers/base | |
| parent | e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af (diff) | |
drivers/base dmam_declare_coherent_memory leaks
dmam_declare_coherent_memory doesn't take into account the return
value of dma_declare_coherent_memory, which leads to incorrect resource
handling
Signed-off-by: Vyacheslav V. Yurkov <uvv.mail@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/dma-mapping.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 2e318ffa019e..8f8b68c80986 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c | |||
| @@ -198,10 +198,13 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, | |||
| 198 | 198 | ||
| 199 | rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size, | 199 | rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size, |
| 200 | flags); | 200 | flags); |
| 201 | if (rc == 0) | 201 | if (rc) { |
| 202 | devres_add(dev, res); | 202 | devres_add(dev, res); |
| 203 | else | 203 | rc = 0; |
| 204 | } else { | ||
| 204 | devres_free(res); | 205 | devres_free(res); |
| 206 | rc = -ENOMEM; | ||
| 207 | } | ||
| 205 | 208 | ||
| 206 | return rc; | 209 | return rc; |
| 207 | } | 210 | } |
