Some error paths in atomisp_open will execute PM runtime
decrement and unregister hmm pool even before we increase
the PM refcount and registration. Fix this by adjusting
jump labels on error.
Signed-off-by: Dinghao Liu <[email protected]>
---
drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 453bb6913550..8f552d6f1f19 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -837,7 +837,7 @@ static int atomisp_open(struct file *file)
ret = pm_runtime_get_sync(vdev->v4l2_dev->dev);
if (ret < 0) {
dev_err(isp->dev, "Failed to power on device\n");
- goto error;
+ goto pm_error;
}
if (dypool_enable) {
@@ -878,9 +878,10 @@ static int atomisp_open(struct file *file)
css_error:
atomisp_css_uninit(isp);
-error:
hmm_pool_unregister(HMM_POOL_TYPE_DYNAMIC);
+pm_error:
pm_runtime_put(vdev->v4l2_dev->dev);
+error:
rt_mutex_unlock(&isp->mutex);
return ret;
}
--
2.17.1