Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1339268pxa; Sun, 2 Aug 2020 04:18:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztam4j23klBBAMLCh5tZb44MNvaxhuQ0vrx3Li2q7fGH0UMcssX1ZMJLwAYUAJkOe5H707 X-Received: by 2002:a17:907:372:: with SMTP id rs18mr11738081ejb.146.1596367112598; Sun, 02 Aug 2020 04:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596367112; cv=none; d=google.com; s=arc-20160816; b=ygydbJ/yRo7Bca2mBZLWt89eeXsUjDsq3dWnYRXIFHf0wTGrrLIeQzv/779Q9K1kH7 PW0vPu+5nsEcjbnML60Y3nPsbzq11E9KqioxkuZyv1SJ6xR+djVtlQFgAxxom+XfsdxW JVeFK2syNPV3edtkZRP6XnluIjipa5PAah/If9ABFDryGCp7nWF7kZfemvVNcPBlDAU9 WqInvmiBHYeE98XHkyBnOU04lwfZCZZ9Of7CScNd+ufnKK1+YkZ3vYO/UT7l3dzXvOVA RJFwpfgG6+2MN/WvDeAjPj7OdmnLSgPyFs5xiTTkoHVwvrkzMGJc0h0wJRtRv4xER6/Y 0otA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=+/+nn9lr/ZhWGfOhjpFBzgLUz615eBAhB4NZe9xCWBU=; b=P0yYo2nwXcL9++cBl2ZeNZKnoFxjCOM1DBYbatXr74vWhgwYH4SPQAqOmwHFdduFsB MljP58w3r5KXU++pE6cKQ0Kcwptj3maW3CuKvxTYBKNIpUuj6GgAisgNbOgRVUMHK12Z hmnz2ay41dx+oVhXVIvAILPgf5cF5CzGYZuYl8HmroGTacsvlUmryUdLewTLMZjXaouQ PlgHJhrGivBoHuyqKmRlURibGmJdtaoZ8DqLG5ssxopgW2zMcQ2ykScfYX7xbxEd2/Gs lE8uR0srlzbV5hYcIrnWccWh5Pft7jIIzCnuQLOpCK2nd0xHFyFOlH3u1Z5kAsTsK0VR w1GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si7258497ejv.169.2020.08.02.04.17.57; Sun, 02 Aug 2020 04:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728132AbgHBLQg (ORCPT + 99 others); Sun, 2 Aug 2020 07:16:36 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:54117 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728159AbgHBLPh (ORCPT ); Sun, 2 Aug 2020 07:15:37 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R361e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0U4T1Vff_1596366933; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U4T1Vff_1596366933) by smtp.aliyun-inc.com(127.0.0.1); Sun, 02 Aug 2020 19:15:33 +0800 From: Tianjia Zhang To: herbert@gondor.apana.org.au, davem@davemloft.net, matthias.bgg@gmail.com, swboyd@chromium.org, yuehaibing@huawei.com, tianjia.zhang@linux.alibaba.com, ryder.lee@mediatek.com Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, tianjia.zhang@alibaba.com Subject: [PATCH] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc() Date: Sun, 2 Aug 2020 19:15:32 +0800 Message-Id: <20200802111532.5110-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 Signed-off-by: Tianjia Zhang --- 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