Commit 06061dc6 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kishon Vijay Abraham I

phy: exynos-mipi-video: avoid uninitialized variable use

A rework of the exynos-mipi-video driver caused a warning
about the new __set_phy_state function potentially accessing
a variable before its initialization:

drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return val & data->resetn_val;
         ~~~~^~~~~~~~~~~~~~~~~~
drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
  u32 val;

The failure scenario here is the offset passed into a the
stub regmap_read() function that does not modify its output,
however regmap_read() can also fail for other reasons, so
adding error handling (in this case, returning zero from
is_running) seems the best solution.

Note that this warning showed up with the ARM s5pv210_defconfig,
indicating that we most likely want to either enable CONFIG_REGMAP
in that defconfig as well, or disable the phy-exynos-mipi-video
driver.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 97a3042f ("phy: exynos-mipi-video: Rewrite handling of phy registers")
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 1a695a90
...@@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data, ...@@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
struct exynos_mipi_video_phy *state) struct exynos_mipi_video_phy *state)
{ {
u32 val; u32 val;
int ret;
ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
if (ret)
return 0;
regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
return val & data->resetn_val; return val & data->resetn_val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment