Move the NULL check of bootscr_flash_size to before the first time it is
dereferenced to avoid any possible segment violations.
This issue found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
ofnode uboot;
*bootscr_flash_offset = 0;
+
+ if (!bootscr_flash_size) {
+ dm_warn("bootscr-flash-size is zero. Ignoring properties!\n");
+ return -EINVAL;
+ }
+
*bootscr_flash_size = 0;
uboot = ofnode_path("/options/u-boot");
if (ret)
return -EINVAL;
- if (!bootscr_flash_size) {
- dm_warn("bootscr-flash-size is zero. Ignoring properties!\n");
- *bootscr_flash_offset = 0;
- return -EINVAL;
- }
-
return 0;
}