summaryrefslogtreecommitdiffstats
path: root/drivers/dma/tegra186-gpc-dma.c
diff options
context:
space:
mode:
authordmitry pervushin <dpervushin@nvidia.com>2016-09-26 09:30:00 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-09-29 16:17:51 -0400
commit7f3e23f8c03b5b0768ef9e7cb9f515b881e0bcbc (patch)
tree46b0e7ffa81020ef7f38c79ff73f8b31bcf18308 /drivers/dma/tegra186-gpc-dma.c
parent8f7380adf21f48024065212fc342636301775e29 (diff)
tegra: dma: fix coverity issue
In case of NULL returned from alloc, it should not passed down to put function, where it can be dereferenced Bug 200222365 Change-Id: I546cdedbbe1c297bb81853b955e7845d2d2085f6 (cherry picked from commit e396da726c8540d0f408c5cb31c3235ba8d5bbaa) Signed-off-by: dmitry pervushin <dpervushin@nvidia.com> Reviewed-on: http://git-master/r/1227729 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com> Tested-by: Sumeet Gupta <sumeetg@nvidia.com>
Diffstat (limited to 'drivers/dma/tegra186-gpc-dma.c')
-rw-r--r--drivers/dma/tegra186-gpc-dma.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 4327d2305..81dc8b32b 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -401,8 +401,10 @@ static struct tegra_dma_sg_req *tegra_dma_sg_req_alloc(
401{ 401{
402 struct tegra_dma_sg_req *sg_req = NULL; 402 struct tegra_dma_sg_req *sg_req = NULL;
403 sg_req = devm_kzalloc(tdc2dev(tdc), sizeof(struct tegra_dma_sg_req), GFP_ATOMIC); 403 sg_req = devm_kzalloc(tdc2dev(tdc), sizeof(struct tegra_dma_sg_req), GFP_ATOMIC);
404 if (!sg_req) 404 if (!sg_req) {
405 dev_err(tdc2dev(tdc), "sg_req alloc failed\n"); 405 dev_err(tdc2dev(tdc), "sg_req alloc failed\n");
406 return NULL;
407 }
406 if (prealloc) 408 if (prealloc)
407 tegra_dma_sg_req_put(tdc, sg_req, true); 409 tegra_dma_sg_req_put(tdc, sg_req, true);
408 return sg_req; 410 return sg_req;