From patchwork Tue Oct 27 13:51:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F135FC55178 for ; Tue, 27 Oct 2020 14:18:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6BD921D42 for ; Tue, 27 Oct 2020 14:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808307; bh=NzSfj4q15xQf+EXIBi9Dgjx2PbhqrBptZGRZNgo4CpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zzCC1ZHdwa7jLwa3lGYvzaoFdOBSpdM9P/xEFsqi9xfzrFViTGWG4VIHpga0uy0ix 4brhkpc8+Bg4Vq7mHdDkNGUYh8Ez9wTAw/YW1ElQr830fZJwyt3bN01GlMPOIHgbx/ gKXsM2waLScdzp5Rruq6/PI1Nnp3r8k9uMUUAS3c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2901086AbgJ0OS0 (ORCPT ); Tue, 27 Oct 2020 10:18:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:41924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2895008AbgJ0OSZ (ORCPT ); Tue, 27 Oct 2020 10:18:25 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53249206D4; Tue, 27 Oct 2020 14:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808304; bh=NzSfj4q15xQf+EXIBi9Dgjx2PbhqrBptZGRZNgo4CpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htDeMBqatzYLrcq8+tZ9sILBoe0cieUP+RmUqtDEjyYYAGgYk6fS4SfJlLB4ewBXP Y9Y2kYmqH4A04Ob7g/RqZzKvB9qGqxX+x69NxdABWwgW54Sx3TfNNdMeZ9MMaIUWor TpDqgfqZorgseAXwHT3+KZYyI0UjBnA2LNmOvRGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryder Lee , Tianjia Zhang , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 040/264] crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc() Date: Tue, 27 Oct 2020 14:51:38 +0100 Message-Id: <20201027135432.550470250@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135430.632029009@linuxfoundation.org> References: <20201027135430.632029009@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tianjia Zhang [ 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 Signed-off-by: Tianjia Zhang Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- 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 ee0404e27a0f2..03b1436f87096 100644 --- a/drivers/crypto/mediatek/mtk-platform.c +++ b/drivers/crypto/mediatek/mtk-platform.c @@ -446,7 +446,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); @@ -480,7 +480,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)