[U-Boot] arm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()

Message ID 766fa417640f8446746e225f315cca1efd2285fc.1528879490.git.michal.simek@xilinx.com
State New
Delegated to: Michal Simek
Headers show
Series
  • [U-Boot] arm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()
Related show

Commit Message

Michal Simek June 13, 2018, 8:44 a.m.
There should be return value check from zynqmp_mmio_read() in
zynqmp_mmio_rawwrite() to make sure that errors are propagated properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/arm/cpu/armv8/zynqmp/cpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/arch/arm/cpu/armv8/zynqmp/cpu.c b/arch/arm/cpu/armv8/zynqmp/cpu.c
index e122be59c747..1279dc8658a1 100644
--- a/arch/arm/cpu/armv8/zynqmp/cpu.c
+++ b/arch/arm/cpu/armv8/zynqmp/cpu.c
@@ -212,8 +212,12 @@  static int zynqmp_mmio_rawwrite(const u32 address,
 {
 	u32 data;
 	u32 value_local = value;
+	int ret;
+
+	ret = zynqmp_mmio_read(address, &data);
+	if (ret)
+		return ret;
 
-	zynqmp_mmio_read(address, &data);
 	data &= ~mask;
 	value_local &= mask;
 	value_local |= data;