Ver código fonte

video: driver: Check capabilities pointer before accessing it

Core capabitlities are not created before opening first instance,
hence add a check before accesing capabilities.

Change-Id: I46b85e685624a2219fcf9e1153f8f470c17dcec0
Signed-off-by: Mihir Ganu <[email protected]>
Mihir Ganu 4 anos atrás
pai
commit
b42f622d58
1 arquivos alterados com 7 adições e 5 exclusões
  1. 7 5
      driver/vidc/src/msm_vidc_debug.c

+ 7 - 5
driver/vidc/src/msm_vidc_debug.c

@@ -222,12 +222,14 @@ static ssize_t debug_level_write(struct file* filp, const char __user* buf,
 		rc = -EINVAL;
 		goto exit;
 	}
-	core->capabilities[HW_RESPONSE_TIMEOUT].value =
-		((msm_vidc_debug & 0xFF) >
-		(VIDC_ERR | VIDC_HIGH)) ? 1500 : 1000;
 	rc = count;
-	d_vpr_h("debug timeout updated to - %d ms\n",
-		core->capabilities[HW_RESPONSE_TIMEOUT].value);
+	if (core->capabilities) {
+		core->capabilities[HW_RESPONSE_TIMEOUT].value =
+			((msm_vidc_debug & 0xFF) >
+			(VIDC_ERR | VIDC_HIGH)) ? 1500 : 1000;
+		d_vpr_h("debug timeout updated to - %d ms\n",
+			core->capabilities[HW_RESPONSE_TIMEOUT].value);
+	}
 
 exit:
 	return rc;