Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp882481pxk; Thu, 17 Sep 2020 20:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9bMiu6PmBugBKiou4OMpW/AZn16Be+1p4FtVPn3hZLBo9PxTml+ayiQrLxhuyXXMq1H9Q X-Received: by 2002:a17:906:3506:: with SMTP id r6mr33779211eja.55.1600398887326; Thu, 17 Sep 2020 20:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398887; cv=none; d=google.com; s=arc-20160816; b=MjIl3Av+2JQ6xd8sljDHSwNWQyPpLMS/RpRs7TfXZDRwb+jmCq+uMtNpHqgTIQtk93 HMfMl4XlYWPdvqKiTe7xaJgDaXyR0eqY7I/1dS+HwetfgsjkHza4f0mBLW54/QvLjlXa Eq6q224KBi4Teecmm4VxxH9sGR8bS1hEgD/ZahJaN+bWDSkAFOkHQP9TKYNmBxDqbTqd 9v21ruhWjECQsbegSPXE2kltR4lSGGUUEdbJy+UVrtl+KYOvc3014KTijkBIyvRaGAdC vDUipScj+pfR+VJJU6MK1yyR4KZWVGIjXZnErw+d6saPra6HVqmgGAh0rxwdb/YRkspD Hw2w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ofmz9WHWSCMsW4ZUxIz5J+C50dWvntbmt4sZ4XJe5HU=; b=c5HyJXOt1s6Xg0RQfnazLe50YOQAB1QF06dV2eN6Yo0xaT8nIVsrM3oSZXm9RBDRH7 xz0Ni0pwoQg+tiU9HiVdH1PkwAJ/2SzeY5ScGv2J4q+2qIe58cTq9Wk6ZmzOfQL0hVbm WoX3OZslU03mEup7ZsOcfweF9/kkXBQyAInzFKHK+azG9l3p5DQPyk3Wzg8wNtLo/wmq 42BB5fKo0iK2X/zHetb6Iy7r3KzY8UWJml8b6oHdj9tqnLLnlOU843UXmx03kdrbp7EO I+ZlTeGMMynG2MVDEFjRl+I1p1hB3HjHulAWroRC3VwIRXz0GiIk0TuqWYMZTEYRamKP rsZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PSulnH6v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si1545484ejs.91.2020.09.17.20.14.23; Thu, 17 Sep 2020 20:14:47 -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=PSulnH6v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbgIRCCH (ORCPT + 99 others); Thu, 17 Sep 2020 22:02:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:47008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbgIRCCF (ORCPT ); Thu, 17 Sep 2020 22:02:05 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69EE8235F9; Fri, 18 Sep 2020 02:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394525; bh=S2yWY6GVlUKNXC6TiofSvJRC76+LiIQlEzBMael9vcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSulnH6vMTx/LJPCmJlPhlvYmnYCu9u/EWTO4EIksc0dYOcfYZTnVPU0PuCzM9yB9 mCDGRDCGkEhxi52rywR5qyMWLRpaRAWuYbkMLlz2IqhFufFZOcGmL94YOyvdEdzkbD i9q94qXWU4qFuxJGaiGdhWO2FY/7CLAG1ZDH5b7g= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Satendra Singh Thakur , Vinod Koul , Sasha Levin , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 046/330] dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails Date: Thu, 17 Sep 2020 21:56:26 -0400 Message-Id: <20200918020110.2063155-46-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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