[PATCH] media: atomisp: Fix error handling in atomisp_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux