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: 4138001 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20892BFF02 for ; Thu, 8 May 2014 17:36:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D70520265 for ; Thu, 8 May 2014 17:36:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C8AC2018B for ; Thu, 8 May 2014 17:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754885AbaEHRgD (ORCPT ); Thu, 8 May 2014 13:36:03 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:46529 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754413AbaEHRgB (ORCPT ); Thu, 8 May 2014 13:36:01 -0400 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>; 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 Cc: devicetree@vger.kernel.org, kyungmin.park@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki 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= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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); }