diff mbox series

gpu: v3d: fix a missing check of pm_runtime_get_sync

Message ID 20190324231602.2436-1-kjlu@umn.edu (mailing list archive)
State New, archived
Headers show
Series gpu: v3d: fix a missing check of pm_runtime_get_sync | expand

Commit Message

Kangjie Lu March 24, 2019, 11:16 p.m. UTC
pm_runtime_get_sync could fail and thus deserves a check.

The patch adds such a check and return its error code upstream
if it indeed failed.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mukesh Ojha March 27, 2019, 3:09 p.m. UTC | #1
On 3/25/2019 4:46 AM, Kangjie Lu wrote:
> pm_runtime_get_sync could fail and thus deserves a check.
>
> The patch adds such a check and return its error code upstream
> if it indeed failed.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

-Mukesh
> ---
>   drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index f0afcec72c34..99daad11fac2 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -101,6 +101,8 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
>   			return -EINVAL;
>   
>   		ret = pm_runtime_get_sync(v3d->dev);
> +		if (ret < 0)
> +			return ret;
>   		if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 &&
>   		    args->param <= DRM_V3D_PARAM_V3D_CORE0_IDENT2) {
>   			args->value = V3D_CORE_READ(0, offset);
Eric Anholt April 1, 2019, 5:49 p.m. UTC | #2
Kangjie Lu <kjlu@umn.edu> writes:

> pm_runtime_get_sync could fail and thus deserves a check.
>
> The patch adds such a check and return its error code upstream
> if it indeed failed.

Applied the review and merged to drm-misc-next.  Thanks!
diff mbox series

Patch

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index f0afcec72c34..99daad11fac2 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -101,6 +101,8 @@  static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
 			return -EINVAL;
 
 		ret = pm_runtime_get_sync(v3d->dev);
+		if (ret < 0)
+			return ret;
 		if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 &&
 		    args->param <= DRM_V3D_PARAM_V3D_CORE0_IDENT2) {
 			args->value = V3D_CORE_READ(0, offset);