Skip to content

Commit 5dea427

Browse files
committed
drm/tegra: sor: Fully initialize SOR before registration
Before registering the SOR host1x client, make sure that it is fully initialized. This avoids a potential race condition between the SOR's probe and the host1x device initialization in cases where the SOR is the final sub-device to register to a host1x instance. Reported-by: Jonathan Hunter <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Tested-by: Jon Hunter <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 0cfe5a6 commit 5dea427

File tree

1 file changed

+13
-14
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+13
-14
lines changed

drivers/gpu/drm/tegra/sor.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3922,17 +3922,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
39223922
platform_set_drvdata(pdev, sor);
39233923
pm_runtime_enable(&pdev->dev);
39243924

3925-
INIT_LIST_HEAD(&sor->client.list);
3925+
host1x_client_init(&sor->client);
39263926
sor->client.ops = &sor_client_ops;
39273927
sor->client.dev = &pdev->dev;
39283928

3929-
err = host1x_client_register(&sor->client);
3930-
if (err < 0) {
3931-
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
3932-
err);
3933-
goto rpm_disable;
3934-
}
3935-
39363929
/*
39373930
* On Tegra210 and earlier, provide our own implementation for the
39383931
* pad output clock.
@@ -3944,13 +3937,13 @@ static int tegra_sor_probe(struct platform_device *pdev)
39443937
sor->index);
39453938
if (!name) {
39463939
err = -ENOMEM;
3947-
goto unregister;
3940+
goto uninit;
39483941
}
39493942

39503943
err = host1x_client_resume(&sor->client);
39513944
if (err < 0) {
39523945
dev_err(sor->dev, "failed to resume: %d\n", err);
3953-
goto unregister;
3946+
goto uninit;
39543947
}
39553948

39563949
sor->clk_pad = tegra_clk_sor_pad_register(sor, name);
@@ -3961,14 +3954,20 @@ static int tegra_sor_probe(struct platform_device *pdev)
39613954
err = PTR_ERR(sor->clk_pad);
39623955
dev_err(sor->dev, "failed to register SOR pad clock: %d\n",
39633956
err);
3964-
goto unregister;
3957+
goto uninit;
3958+
}
3959+
3960+
err = __host1x_client_register(&sor->client);
3961+
if (err < 0) {
3962+
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
3963+
err);
3964+
goto uninit;
39653965
}
39663966

39673967
return 0;
39683968

3969-
unregister:
3970-
host1x_client_unregister(&sor->client);
3971-
rpm_disable:
3969+
uninit:
3970+
host1x_client_exit(&sor->client);
39723971
pm_runtime_disable(&pdev->dev);
39733972
remove:
39743973
tegra_output_remove(&sor->output);

0 commit comments

Comments
 (0)