Avoid to ignore the OTP read/write error and transmits the error
to STM32CubeProgrammer.
Today the error is only displayed in log error:
so the user on HOST thinks the OTP operation is performed.
Reported-by: Mickael GARDET <m.gardet@overkiz.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Fixes: 75ea9e75931c ("stm32mp: stm32prog: add TEE support in stm32prog command")
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
if (!data->otp_part) {
data->otp_part = memalign(CONFIG_SYS_CACHELINE_SIZE, otp_size);
- if (!data->otp_part)
+ if (!data->otp_part) {
+ stm32prog_err("OTP write issue %d", -ENOMEM);
+
return -ENOMEM;
+ }
}
if (!offset)
memcpy(buffer, (void *)((uintptr_t)data->otp_part + offset), *size);
end_otp_read:
+ if (result)
+ stm32prog_err("OTP read issue %d", result);
log_debug("%s: result %i\n", __func__, result);
return result;
free(data->otp_part);
data->otp_part = NULL;
+ if (result)
+ stm32prog_err("OTP write issue %d", result);
log_debug("%s: result %i\n", __func__, result);
return result;