mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 15:34:48 +08:00
media: qcom: camss: Fix genpd cleanup
Right now we never release the power-domains properly on the error path.
Add a routine to be reused for this purpose and appropriate jumps in
probe() to run that routine where necessary.
Fixes: 2f6f8af672
("media: camss: Refactor VFE power domain toggling")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
b278080a89
commit
f69791c397
@ -1538,6 +1538,20 @@ static int camss_icc_get(struct camss *camss)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void camss_genpd_cleanup(struct camss *camss)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (camss->genpd_num == 1)
|
||||
return;
|
||||
|
||||
if (camss->genpd_num > camss->vfe_num)
|
||||
device_link_del(camss->genpd_link[camss->genpd_num - 1]);
|
||||
|
||||
for (i = 0; i < camss->genpd_num; i++)
|
||||
dev_pm_domain_detach(camss->genpd[i], true);
|
||||
}
|
||||
|
||||
/*
|
||||
* camss_probe - Probe CAMSS platform device
|
||||
* @pdev: Pointer to CAMSS platform device
|
||||
@ -1627,11 +1641,11 @@ static int camss_probe(struct platform_device *pdev)
|
||||
|
||||
ret = camss_init_subdevices(camss);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err_genpd_cleanup;
|
||||
|
||||
ret = dma_set_mask_and_coherent(dev, 0xffffffff);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_genpd_cleanup;
|
||||
|
||||
camss->media_dev.dev = camss->dev;
|
||||
strscpy(camss->media_dev.model, "Qualcomm Camera Subsystem",
|
||||
@ -1643,7 +1657,7 @@ static int camss_probe(struct platform_device *pdev)
|
||||
ret = v4l2_device_register(camss->dev, &camss->v4l2_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to register V4L2 device: %d\n", ret);
|
||||
return ret;
|
||||
goto err_genpd_cleanup;
|
||||
}
|
||||
|
||||
v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
|
||||
@ -1693,28 +1707,19 @@ err_register_subdevs:
|
||||
err_v4l2_device_unregister:
|
||||
v4l2_device_unregister(&camss->v4l2_dev);
|
||||
v4l2_async_nf_cleanup(&camss->notifier);
|
||||
err_genpd_cleanup:
|
||||
camss_genpd_cleanup(camss);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void camss_delete(struct camss *camss)
|
||||
{
|
||||
int i;
|
||||
|
||||
v4l2_device_unregister(&camss->v4l2_dev);
|
||||
media_device_unregister(&camss->media_dev);
|
||||
media_device_cleanup(&camss->media_dev);
|
||||
|
||||
pm_runtime_disable(camss->dev);
|
||||
|
||||
if (camss->genpd_num == 1)
|
||||
return;
|
||||
|
||||
if (camss->genpd_num > camss->vfe_num)
|
||||
device_link_del(camss->genpd_link[camss->genpd_num - 1]);
|
||||
|
||||
for (i = 0; i < camss->genpd_num; i++)
|
||||
dev_pm_domain_detach(camss->genpd[i], true);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1733,6 +1738,8 @@ static void camss_remove(struct platform_device *pdev)
|
||||
|
||||
if (atomic_read(&camss->ref_count) == 0)
|
||||
camss_delete(camss);
|
||||
|
||||
camss_genpd_cleanup(camss);
|
||||
}
|
||||
|
||||
static const struct of_device_id camss_dt_match[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user