Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56002623 authored by Srinu Gorle's avatar Srinu Gorle
Browse files

msm: vidc: skip fps round off when client sets 1 fps



sometimes fps is rounded off one lesser, makes it
to zero, when the client is setting fps as 1.
This exposes division by zero crash when calculating
the load for non realtime usescases. Crash is observed
in recent monkey runs.

Change-Id: I4ec824d658ed3a14ab43ca031e989b01adfddc11
Signed-off-by: default avatarSrinu Gorle <sgorle@codeaurora.org>
parent bf1f2607
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -301,8 +301,14 @@ int msm_comm_get_inst_load(struct msm_vidc_inst *inst,
	 */

	if (is_non_realtime_session(inst) &&
		(quirks & LOAD_CALC_IGNORE_NON_REALTIME_LOAD))
		(quirks & LOAD_CALC_IGNORE_NON_REALTIME_LOAD)) {
		if (!inst->prop.fps) {
			dprintk(VIDC_INFO, "instance:%p fps = 0\n", inst);
			load = 0;
		} else {
			load = msm_comm_get_mbs_per_sec(inst) / inst->prop.fps;
		}
	}

exit:
	mutex_unlock(&inst->lock);
@@ -5023,7 +5029,7 @@ int msm_vidc_comm_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a)

	if (fps % 15 == 14 || fps % 24 == 23)
		fps = fps + 1;
	else if (fps % 24 == 1 || fps % 15 == 1)
	else if ((fps > 1) && (fps % 24 == 1 || fps % 15 == 1))
		fps = fps - 1;

	if (inst->prop.fps != fps) {