* [patch] dma: mv_xor: error handling fix in mv_xor_channel_add()
@ 2013-08-22 12:58 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-08-22 12:58 UTC (permalink / raw)
To: Vinod Koul
Cc: Dan Williams, Grant Likely, Rob Herring, devicetree,
kernel-janitors
We haven't allocated the dma buffer at this point and also if we
"goto err_free_dma;" then it leads to a NULL dereference. Just return
directly.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I can't compile this file.
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index d9a2677..0e9e835 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1029,10 +1029,8 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
struct dma_device *dma_dev;
mv_chan = devm_kzalloc(&pdev->dev, sizeof(*mv_chan), GFP_KERNEL);
- if (!mv_chan) {
- ret = -ENOMEM;
- goto err_free_dma;
- }
+ if (!mv_chan)
+ return ERR_PTR(-ENOMEM);
mv_chan->idx = idx;
mv_chan->irq = irq;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-22 12:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 12:58 [patch] dma: mv_xor: error handling fix in mv_xor_channel_add() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox