linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc()
@ 2020-08-02 11:15 Tianjia Zhang
  2020-08-21  7:55 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Tianjia Zhang @ 2020-08-02 11:15 UTC (permalink / raw)
  To: herbert, davem, matthias.bgg, swboyd, yuehaibing, tianjia.zhang,
	ryder.lee
  Cc: linux-crypto, linux-arm-kernel, linux-mediatek, linux-kernel,
	tianjia.zhang

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>
---
 drivers/crypto/mediatek/mtk-platform.c | 4 ++--
 1 file 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 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)
 				  ring[i]->cmd_base, ring[i]->cmd_dma);
 		kfree(ring[i]);
 	}
-	return err;
+	return -ENOMEM;
 }
 
 static int mtk_crypto_probe(struct platform_device *pdev)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc()
  2020-08-02 11:15 [PATCH] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc() Tianjia Zhang
@ 2020-08-21  7:55 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-08-21  7:55 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: davem, matthias.bgg, swboyd, yuehaibing, ryder.lee, linux-crypto,
	linux-arm-kernel, linux-mediatek, linux-kernel, tianjia.zhang

On Sun, Aug 02, 2020 at 07:15:32PM +0800, Tianjia Zhang wrote:
> 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>
> ---
>  drivers/crypto/mediatek/mtk-platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-21  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 11:15 [PATCH] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc() Tianjia Zhang
2020-08-21  7:55 ` Herbert Xu

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).