From patchwork Thu Apr 28 10:25:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 8967751 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C4CE89FB96 for ; Thu, 28 Apr 2016 10:25:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 088BA202A1 for ; Thu, 28 Apr 2016 10:25:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 103C620295 for ; Thu, 28 Apr 2016 10:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751518AbcD1KZT (ORCPT ); Thu, 28 Apr 2016 06:25:19 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62946 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbcD1KZS (ORCPT ); Thu, 28 Apr 2016 06:25:18 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6C00A0VAA32R90@mailout4.w1.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-ca-5721e50b1115 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 87.30.05254.B05E1275; Thu, 28 Apr 2016 11:25:15 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6C002MPA9ZLM80@eusync4.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Jacek Anaszewski , Sakari Ailus , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe Date: Thu, 28 Apr 2016 12:25:03 +0200 Message-id: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t/xa7rcTxXDDZpWCVtsnLGe1aL36nNG i9cvDC16NmxltZhxfh+Txdojd9ktDr9pZ7X4tOUbkwOHx7yTgR59W1YxenzeJBfAHMVlk5Ka k1mWWqRvl8CVcWjWLOaCAzwVj39vYmpgvMXVxcjJISFgInHt4jYmCFtM4sK99WxdjFwcQgJL GSXaH85lgnCamCQuf3nOAlLFJmAo0fW2iw3EFhFwklg46y87SBGzwFImiY3nvoONEhZwkdg4 pQ8owcHBIqAqcfFkBUiYV8BD4vTZHcwQ2+Qk/r9cwTSBkXsBI8MqRtHU0uSC4qT0XEO94sTc 4tK8dL3k/NxNjJDA+LKDcfExq0OMAhyMSjy8kxIUw4VYE8uKK3MPMUpwMCuJ8Jo/AQrxpiRW VqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpiSWp2ampBahFMlomDU6qBUULK8KaLTeQM1Vyz ac4ZrJ5/zv8r+7zxt9G1QCmHUzy710tffvL7YoVdQ/BUr/PXxY/FBFyaIhuwljvy1PGrvCwe J5/9XqlVb21998Cy+dqXDltfZ3PYsbsr0vvS6b++3nLt1TbhOxivJzAqycs0Gu2oVFMP6iqO 5grXltSQOZp5/0DeEa8nSizFGYmGWsxFxYkA+vqotwgCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.9 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 Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always keep a graph walk large enough around") changed media_device_register_entity() function to take mdev->graph_mutex. This causes deadlock in driver probe, which calls (indirectly) this function with ->graph_mutex taken. This patch removes taking ->graph_mutex in driver probe to avoid deadlock. Other drivers don't take ->graph_mutex for entity registration, so this change should be safe. Signed-off-by: Marek Szyprowski Acked-by: Sakari Ailus Acked-by: Hans Verkuil Tested-by: Hans Verkuil --- drivers/media/platform/exynos4-is/media-dev.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 04348b502232..891625e77ef5 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1448,22 +1448,13 @@ static int fimc_md_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fmd); - /* Protect the media graph while we're registering entities */ - mutex_lock(&fmd->media_dev.graph_mutex); - ret = fimc_md_register_platform_entities(fmd, dev->of_node); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_clk; - } ret = fimc_md_register_sensor_entities(fmd); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_m_ent; - } - - mutex_unlock(&fmd->media_dev.graph_mutex); ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode); if (ret)