summaryrefslogtreecommitdiff
path: root/drivers/crypto/mediatek
diff options
context:
space:
mode:
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>2020-08-02 19:15:32 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 09:57:30 +0100
commit3dd9ffbb6eda28b73e4523cf1780d5b15caffe31 (patch)
treeeb0623e8bfb216b677423c5b111dd0547b44d6e0 /drivers/crypto/mediatek
parent528acbf310ff43f943f57b4921fd933ea6988e33 (diff)
crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc()
[ Upstream commit 8cbde6c6a6d2b1599ff90f932304aab7e32fce89 ] In case of memory allocation failure, a negative error code should be returned. Fixes: 785e5c616c849 ("crypto: mediatek - Add crypto driver support for some MediaTek chips") Cc: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto/mediatek')
-rw-r--r--drivers/crypto/mediatek/mtk-platform.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/mediatek/mtk-platform.c b/drivers/crypto/mediatek/mtk-platform.c
index 7e3ad085b5bd..ef4339e84d03 100644
--- a/drivers/crypto/mediatek/mtk-platform.c
+++ b/drivers/crypto/mediatek/mtk-platform.c
@@ -442,7 +442,7 @@ static void mtk_desc_dma_free(struct mtk_cryp *cryp)
static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)
{
struct mtk_ring **ring = cryp->ring;
- int i, err = ENOMEM;
+ int i;
for (i = 0; i < MTK_RING_MAX; i++) {
ring[i] = kzalloc(sizeof(**ring), GFP_KERNEL);
@@ -476,7 +476,7 @@ err_cleanup:
ring[i]->cmd_base, ring[i]->cmd_dma);
kfree(ring[i]);
}
- return err;
+ return -ENOMEM;
}
static int mtk_crypto_probe(struct platform_device *pdev)