Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3743084pxk; Tue, 29 Sep 2020 05:18:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWhFlhK/BwxGfnUpYqTiy3FxSF27Xk7Kcuf5of2Kkhzy2GRBE6/MsMkEnNIBws3jJX/CrE X-Received: by 2002:a50:9b19:: with SMTP id o25mr2789893edi.340.1601381894270; Tue, 29 Sep 2020 05:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601381894; cv=none; d=google.com; s=arc-20160816; b=e8GZLdo3HfM7NMQwt3I44ihnTZrTvsXpkGvs74qcTrHwGoW1qjFa0Ras0GaULeGuJy HlB6jPFvQG6/8gQtOvXtEsNyiveIcqXAJ54lzkxsN0w+Z8jA4/t68OnnH4DV9jxpKHo+ SpDrAgbE3lsLPxadTBK5KGzAvK4BHZsnIu1OhnrFVpC/bhSe4UCRFFgnx8kskbZtI9j8 iu56i1SfjE+B1zgJpcpQw2FqvgyeXLPSZJXuIcRSTFnfkrYI9HtlEeho9yJQwO78/ahV Ml/KyBhFUg+9ecJuFwzaff0zWx5COkAZjWnBre0RUqDC1kC+5nSnbj80ZfIAwe5Jyia7 fWoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ofmz9WHWSCMsW4ZUxIz5J+C50dWvntbmt4sZ4XJe5HU=; b=KZm1ifc2d4hKqaxYRpoX/w2795H8gQnrxxzZ1aswdQjJwGoZMUAFtwACP6rzXoJid7 jTI1PuW2U7MndkRyqE4a3b1P063bZP7QgEc15OYIytGpFJxVgy4VxilMgIE9mf8WVA05 G9gMHFT0Uv7/mz+WImrTiPP9yx5P1DsN8+zkgMjW8OG9Gf7+dp6VAc6OsTd9Rbrm4CkA XnSRIbY8khggBEOngj4wxvfKKRHK08u839mAQTww9pYUC8K5+TwHu9WwuuXWtaDvTXSK czgXRyKVZ1TYccumvonVnNkEohKdI5zeioRfZshq4MR17blxSdqn44dwstJuOrRfBHSt xaxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tvCtsuFn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si2583988edm.308.2020.09.29.05.17.51; Tue, 29 Sep 2020 05:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tvCtsuFn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732190AbgI2MQz (ORCPT + 99 others); Tue, 29 Sep 2020 08:16:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:49122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730047AbgI2LhA (ORCPT ); Tue, 29 Sep 2020 07:37:00 -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 C7B2D23ECE; Tue, 29 Sep 2020 11:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379169; bh=S2yWY6GVlUKNXC6TiofSvJRC76+LiIQlEzBMael9vcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tvCtsuFn/yl8zFKmCgtc69VVk0WPsICXo4W+X042vNZXsM8iIobrzTKbFiIqsar4c cslrZ2C0awELdX9RxH6s0yjINrbJudiiEn+xWz0ZOqHY0SaB/8HOQP9g/nPZ8SC1vd Dn5nyaxLlbEeLQ3bTw19xobwVnBSo/DaCHID3FPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Satendra Singh Thakur , Vinod Koul , Sasha Levin Subject: [PATCH 5.4 043/388] dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails Date: Tue, 29 Sep 2020 12:56:14 +0200 Message-Id: <20200929110012.576933186@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Satendra Singh Thakur [ Upstream commit 1ff95243257fad07290dcbc5f7a6ad79d6e703e2 ] When devm_request_irq fails, currently, the function dma_async_device_unregister gets called. This doesn't free the resources allocated by of_dma_controller_register. Therefore, we have called of_dma_controller_free for this purpose. Signed-off-by: Satendra Singh Thakur Link: https://lore.kernel.org/r/20191109113523.6067-1-sst2005@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/mediatek/mtk-hsdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c index 1a2028e1c29e9..4c58da7421432 100644 --- a/drivers/dma/mediatek/mtk-hsdma.c +++ b/drivers/dma/mediatek/mtk-hsdma.c @@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev) if (err) { dev_err(&pdev->dev, "request_irq failed with err %d\n", err); - goto err_unregister; + goto err_free; } platform_set_drvdata(pdev, hsdma); @@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev) return 0; +err_free: + of_dma_controller_free(pdev->dev.of_node); err_unregister: dma_async_device_unregister(dd); -- 2.25.1