Merge "ipq40xx: kw fix: Avoid Null pointer dereferencing"
diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c
index f2d4186..844c578 100644
--- a/board/qca/arm/common/fdt_fixup.c
+++ b/board/qca/arm/common/fdt_fixup.c
@@ -540,9 +540,11 @@
}
ipq_fdt_fixup_socinfo(blob);
s = (getenv("gmacnumber"));
- strict_strtoul(s, 16, &gmac_no);
- if (gmac_no > 2 && gmac_no < 6)
- ipq40xx_patch_eth_params(blob, gmac_no);
+ if (s) {
+ strict_strtoul(s, 16, &gmac_no);
+ if (gmac_no > 2 && gmac_no < 6)
+ ipq40xx_patch_eth_params(blob, gmac_no);
+ }
dcache_disable();
fdt_fixup_ethernet(blob);
ipq_fdt_fixup_usb_device_mode(blob);