Commit 775115c0 authored by Vyacheslav V. Yurkov's avatar Vyacheslav V. Yurkov Committed by Greg Kroah-Hartman

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: default avatarVyacheslav V. Yurkov <uvv.mail@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e330b9a6
...@@ -198,10 +198,13 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, ...@@ -198,10 +198,13 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size, rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size,
flags); flags);
if (rc == 0) if (rc) {
devres_add(dev, res); devres_add(dev, res);
else rc = 0;
} else {
devres_free(res); devres_free(res);
rc = -ENOMEM;
}
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment