Skip to contentSkip to conversation

gpu: v3d: fix a missing check of pm_runtime_get_sync

PATCH In review Kangjie Lu 3 participants 4 messages Mar 24, 2019 – Apr 1, 2019

Subsystems (3)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 gpu: v3d: fix a missing check of pm_runtime_get_sync

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.

---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/v3d/v3d_drv.c +2 -0
index f0afcec72c34..99daad11fac2 100644
@@ -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);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kangjie Lu

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.

Reviewed-by Mukesh Ojha <[email protected] <mailto:[email protected]>>

Thanks.
Mukesh

Quoted 9 lines
---
  drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/v3d/v3d_drv.c +0 -0
index f0afcec72c34..99daad11fac2 100644

drivers/gpu/drm/v3d/v3d_drv.c static int v3d_get_param_ioctl(struct drm_device *dev, void *data, · line 108

Quoted 8 lines
drivers/gpu/drm/v3d/v3d_drv.c +2 -0
@@ -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);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Kangjie Lu
Quoted 6 lines · Kangjie Lu

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.

-Mukesh

Quoted 17 lines
---
  drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/v3d/v3d_drv.c +2 -0
index f0afcec72c34..99daad11fac2 100644
@@ -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);
#3 lore raw
In reply to Kangjie Lu
Quoted 4 lines · Kangjie Lu

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!