* [PATCH] dmaengine: edma: Check the memory allocation for the memcpy dma device
@ 2018-03-21 8:30 Peter Ujfalusi
2018-03-27 12:13 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2018-03-21 8:30 UTC (permalink / raw)
To: linux-arm-kernel
If the allocation fails then disable the memcpy support.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/dma/edma.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 5b197473106b..519e69e81fca 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -1899,6 +1899,11 @@ static void edma_dma_init(struct edma_cc *ecc, bool legacy_mode)
if (memcpy_channels) {
m_ddev = devm_kzalloc(ecc->dev, sizeof(*m_ddev), GFP_KERNEL);
+ if (!m_ddev) {
+ dev_warn(ecc->dev, "memcpy is disabled due to OoM\n");
+ memcpy_channels = NULL;
+ goto ch_setup;
+ }
ecc->dma_memcpy = m_ddev;
dma_cap_zero(m_ddev->cap_mask);
@@ -1926,6 +1931,7 @@ static void edma_dma_init(struct edma_cc *ecc, bool legacy_mode)
dev_info(ecc->dev, "memcpy is disabled\n");
}
+ch_setup:
for (i = 0; i < ecc->num_channels; i++) {
struct edma_chan *echan = &ecc->slave_chans[i];
echan->ch_num = EDMA_CTLR_CHAN(ecc->id, i);
--
Peter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] dmaengine: edma: Check the memory allocation for the memcpy dma device
2018-03-21 8:30 [PATCH] dmaengine: edma: Check the memory allocation for the memcpy dma device Peter Ujfalusi
@ 2018-03-27 12:13 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2018-03-27 12:13 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 21, 2018 at 10:30:22AM +0200, Peter Ujfalusi wrote:
> If the allocation fails then disable the memcpy support.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-27 12:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 8:30 [PATCH] dmaengine: edma: Check the memory allocation for the memcpy dma device Peter Ujfalusi
2018-03-27 12:13 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).