From patchwork Fri Jan 24 09:32:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233108 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 C6800C35242 for ; Fri, 24 Jan 2020 10:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EDB52077C for ; Fri, 24 Jan 2020 10:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579860491; bh=EVYCLhl3aSyIlLBSjPhYlqMCqS83Y0VVh46fwKa/l2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YlC5iALpRhidGSd7M/GlaVXdVdLaUgHpp6i4oB/OLwo2k5+ZCTnJ/XIxvdVXrBQ1Z mkZ/BdawRX5Aoe0wMlKVFdYxIVJQlde825v0DtxEe6+0YsFsNwf0RgxvuRJpDyIHe/ YDQQHoIsDXMLMbXUkS4AV5S90EZq4bFAC2O0oQuc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388028AbgAXKIK (ORCPT ); Fri, 24 Jan 2020 05:08:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:44932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389261AbgAXKIJ (ORCPT ); Fri, 24 Jan 2020 05:08:09 -0500 Received: from localhost (unknown [145.15.244.15]) (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 312872077C; Fri, 24 Jan 2020 10:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579860488; bh=EVYCLhl3aSyIlLBSjPhYlqMCqS83Y0VVh46fwKa/l2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GF1S5rdNhv6XKOlYrMxFhhwEgBf7ooS2H+uEpP5ILmi29WNmVl0oDc34n7nvDPfDw iBCSwZOPEAflVack2nvPbQaWg/pKNB5Dk7JkTd6PGNlFnHMKBwwzYHfZ0FpczSKRq8 kXFQKG81sLNANIpeKW3bX5JdTJyncra9pUVcp2ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 338/343] dmaengine: ti: edma: fix missed failure handling Date: Fri, 24 Jan 2020 10:32:36 +0100 Message-Id: <20200124093004.248067110@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chuhong Yuan [ Upstream commit 340049d453682a9fe8d91fe794dd091730f4bb25 ] When devm_kcalloc fails, it forgets to call edma_free_slot. Replace direct return with failure handler to fix it. Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding") Signed-off-by: Chuhong Yuan Link: https://lore.kernel.org/r/20191118073802.28424-1-hslester96@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 519c24465dea4..57a49fe713fdc 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -2340,8 +2340,10 @@ static int edma_probe(struct platform_device *pdev) ecc->tc_list = devm_kcalloc(dev, ecc->num_tc, sizeof(*ecc->tc_list), GFP_KERNEL); - if (!ecc->tc_list) - return -ENOMEM; + if (!ecc->tc_list) { + ret = -ENOMEM; + goto err_reg1; + } for (i = 0;; i++) { ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs",