Skip to content

Commit 8329d0c

Browse files
wensmchehab
authored andcommitted
media: mtk-jpeg: Set platform driver data earlier
In the multi-core JPEG encoder/decoder setup, the driver for the individual cores references the parent device's platform driver data. However, in the parent driver, this is only set at the end of the probe function, way later than devm_of_platform_populate(), which triggers the probe of the cores. This causes a kernel splat in the sub-device probe function. Move platform_set_drvdata() to before devm_of_platform_populate() to fix this. Fixes: 934e8bc ("mtk-jpegenc: support jpegenc multi-hardware") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 0cb1d9c commit 8329d0c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
13101310
jpeg->dev = &pdev->dev;
13111311
jpeg->variant = of_device_get_match_data(jpeg->dev);
13121312

1313+
platform_set_drvdata(pdev, jpeg);
1314+
13131315
ret = devm_of_platform_populate(&pdev->dev);
13141316
if (ret) {
13151317
v4l2_err(&jpeg->v4l2_dev, "Master of platform populate failed.");
@@ -1381,8 +1383,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
13811383
jpeg->variant->dev_name, jpeg->vdev->num,
13821384
VIDEO_MAJOR, jpeg->vdev->minor);
13831385

1384-
platform_set_drvdata(pdev, jpeg);
1385-
13861386
pm_runtime_enable(&pdev->dev);
13871387

13881388
return 0;

0 commit comments

Comments
 (0)