From patchwork Thu May 8 17:35:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 4138031 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D5A2F9F1E1 for ; Thu, 8 May 2014 17:37:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15C6820265 for ; Thu, 8 May 2014 17:37:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFB61201DE for ; Thu, 8 May 2014 17:37:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiSF8-0002fk-Pa; Thu, 08 May 2014 17:36:26 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiSF4-0001yo-Pa for linux-arm-kernel@lists.infradead.org; Thu, 08 May 2014 17:36:23 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5900I6FNK0A880@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 09 May 2014 02:36:00 +0900 (KST) X-AuditID: cbfee61a-b7f2b6d000006c4d-25-536bc0807a7e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0B.9C.27725.080CB635; Fri, 09 May 2014 02:36:00 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5900EYVNJBT880@mmp1.samsung.com>; Fri, 09 May 2014 02:36:00 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Subject: [PATCH V2 1/4] exynos4-is: Free FIMC-IS CPU memory only when allocated Date: Thu, 08 May 2014 19:35:15 +0200 Message-id: <1399570516-29782-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFJMWRmVeSWpSXmKPExsVy+t9jAd2GA9nBBtcnCljMP3KO1eJs0xt2 i02Pr7FaXN41h82iZ8NWVovDb9pZHdg8Ni+p9+jbsorR4/MmuQDmKC6blNSczLLUIn27BK6M +T83MhU8Z694tfoISwPjBbYuRk4OCQETiSU7WlkgbDGJC/fWA8W5OIQEFjFKXGltYQRJCAl0 MEn0rQ8BsdkEDCV6j/aBxUUE5CWe9N4Aa2AWWMco8WtePzNIQljAX+LynVlgRSwCqhLvf88E inNw8Aq4Sdzd6w1iSggoSMyZZDOBkXsBI8MqRtHUguSC4qT0XEO94sTc4tK8dL3k/NxNjOAQ eCa1g3Flg8UhRgEORiUe3hdTsoOFWBPLiitzDzFKcDArifC+WAYU4k1JrKxKLcqPLyrNSS0+ xCjNwaIkznug1TpQSCA9sSQ1OzW1ILUIJsvEwSnVwJh15JLsh0kOtmqW5oZZbItWX3Wdpnpn YcqRc7/Fs39Knn+nOFFf5IenfeeV/1kNLNv2Oaz/vWbKuZl8vvNbvtqprhPhPxF2cernc9uW 5/e5s6/b0loQrfp66o0p99jfXGVefemts/Cfi6eKOvNiKpbtlVNd+2C59pZX8iaFrKnLGr7w PfKzYtNQYinOSDTUYi4qTgQApc7wTP0BAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140508_103623_026467_45006EC2 X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) Cc: devicetree@vger.kernel.org, kyungmin.park@samsung.com, Sylwester Nawrocki , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure dma_free_coherent() is not called with incorrect arguments and only when the memory was actually allocated. This will prevent possible crashes on error paths of the top level media device driver, when fimc-is device gets unregistered and its driver detached. Signed-off-by: Sylwester Nawrocki Acked-by: Kyungmin Park --- drivers/media/platform/exynos4-is/fimc-is.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 128b73b..5476dce 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -367,6 +367,9 @@ static void fimc_is_free_cpu_memory(struct fimc_is *is) { struct device *dev = &is->pdev->dev; + if (is->memory.vaddr == NULL) + return; + dma_free_coherent(dev, is->memory.size, is->memory.vaddr, is->memory.paddr); }