summaryrefslogtreecommitdiff
path: root/include/soc
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-02-11 21:03:21 +0300
committerThierry Reding <treding@nvidia.com>2016-04-05 16:22:45 +0300
commite8cf6616a346029fe3e3931dd34fc589fade4b6e (patch)
tree0be012e6dd45682b80250d4589b0785a508729c2 /include/soc
parent0259f522e04f19b433a4dc7586d80da106afbbcc (diff)
downloadlinux-e8cf6616a346029fe3e3931dd34fc589fade4b6e.tar.xz
soc/tegra: pmc: Protect public functions from potential race conditions
The PMC base address pointer is initialised during early boot so that early platform code may used the PMC public functions. During the probe of the PMC driver the base address pointer is mapped again and the initial mapping is freed. This exposes a window where a device accessing the PMC registers via one of the public functions, could race with the updating of the pointer and lead to a invalid access. Furthermore, the only protection between multiple devices attempting to access the PMC registers is when setting the powergate state to on or off. None of the other public functions that access the PMC registers are protected. Use the existing mutex to protect paths that may race with regard to accessing the PMC registers. Note that functions tegra_io_rail_prepare()/poll() either return a negative value on failure or zero on success. Therefore, it is not necessary to check if the return value is less than zero and so only test that the return value is not zero to test for failure. This simplifies the error handling with the mutex locking in place. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/soc')
0 files changed, 0 insertions, 0 deletions