Re: [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/28/2016 12:25 PM, Marek Szyprowski wrote:
> 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 <m.szyprowski@xxxxxxxxxxx>

Acked-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
Tested-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>

Thanks!

	Hans

> ---
>  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)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux