diff mbox series

media: atomisp: Fix error handling in atomisp_open

Message ID 20210408065706.9681-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New
Headers show
Series media: atomisp: Fix error handling in atomisp_open | expand

Commit Message

Dinghao Liu April 8, 2021, 6:56 a.m. UTC
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 <dinghao.liu@zju.edu.cn>
---
 drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;
 }