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

Commit 83cab683 authored by Deepak Kumar's avatar Deepak Kumar
Browse files

msm: kgsl: Handle error from nvmem_cell_read while reading speed_bin fuse



nvmem_cell_read can return ERR_PTR in case of failure. Current code is not
handling the error case. This would result in using default clock plan as
speed_bin value is zero. This can be fatal in case fuse was blown to a
lower frequency then the default clock plan. Handle this error to avoid
this issue.

Change-Id: Ic128265fdd1adefbbc0d7f733ef3e9b2f6fcb31a
Signed-off-by: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent 887fabcf
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1350,15 +1350,15 @@ static int adreno_read_speed_bin(struct platform_device *pdev,
	}
	}


	buf = nvmem_cell_read(cell, &len);
	buf = nvmem_cell_read(cell, &len);
	nvmem_cell_put(cell);

	if (!IS_ERR(buf)) {
	if (!IS_ERR(buf)) {
		memcpy(&adreno_dev->speed_bin, buf,
		memcpy(&adreno_dev->speed_bin, buf,
				min(len, sizeof(adreno_dev->speed_bin)));
				min(len, sizeof(adreno_dev->speed_bin)));
		kfree(buf);
		kfree(buf);
	}
	}


	nvmem_cell_put(cell);
	return PTR_ERR_OR_ZERO(buf);

	return 0;
}
}


static int adreno_probe_efuse(struct platform_device *pdev,
static int adreno_probe_efuse(struct platform_device *pdev,