drm/msm/gpu: Fix a couple memory leaks in debugfs
The msm_gpu_open() function should free "show_priv" on error or it
causes static checker warnings.
Fixes: 4f776f4511 ("drm/msm/gpu: Convert the GPU show function to use the GPU state")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
This commit is contained in:
@@ -84,7 +84,7 @@ static int msm_gpu_open(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
ret = mutex_lock_interruptible(&dev->struct_mutex);
|
ret = mutex_lock_interruptible(&dev->struct_mutex);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto free_priv;
|
||||||
|
|
||||||
pm_runtime_get_sync(&gpu->pdev->dev);
|
pm_runtime_get_sync(&gpu->pdev->dev);
|
||||||
show_priv->state = gpu->funcs->gpu_state_get(gpu);
|
show_priv->state = gpu->funcs->gpu_state_get(gpu);
|
||||||
@@ -94,13 +94,20 @@ static int msm_gpu_open(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
if (IS_ERR(show_priv->state)) {
|
if (IS_ERR(show_priv->state)) {
|
||||||
ret = PTR_ERR(show_priv->state);
|
ret = PTR_ERR(show_priv->state);
|
||||||
kfree(show_priv);
|
goto free_priv;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show_priv->dev = dev;
|
show_priv->dev = dev;
|
||||||
|
|
||||||
return single_open(file, msm_gpu_show, show_priv);
|
ret = single_open(file, msm_gpu_show, show_priv);
|
||||||
|
if (ret)
|
||||||
|
goto free_priv;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
free_priv:
|
||||||
|
kfree(show_priv);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations msm_gpu_fops = {
|
static const struct file_operations msm_gpu_fops = {
|
||||||
|
|||||||
Reference in New Issue
Block a user