mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-12 12:46:43 +07:00
ARM: imx: Fix boot crash if ocotp is not found
The imx_soc_device_init functions tries to fetch the ocotp regmap in
order to soc serial number. If regmap fetch fails then a message is
printed but regmap_read is called anyway and the system crashes.
Failing to lookup ocotp regmap shouldn't be a fatal boot error so check
that the pointer is valid.
Only side-effect of ocotp lookup failure now is that serial number will
be reported as all-zeros which is acceptable.
Cc: stable@vger.kernel.org
Fixes: 8267ff89b7
("ARM: imx: Add serial number support for i.MX6/7 SoCs")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
This commit is contained in:
parent
46db63abb7
commit
7947e3238b
@ -84,7 +84,7 @@ struct device * __init imx_soc_device_init(void)
|
||||
const char *ocotp_compat = NULL;
|
||||
struct soc_device *soc_dev;
|
||||
struct device_node *root;
|
||||
struct regmap *ocotp;
|
||||
struct regmap *ocotp = NULL;
|
||||
const char *soc_id;
|
||||
u64 soc_uid = 0;
|
||||
u32 val;
|
||||
@ -175,7 +175,9 @@ struct device * __init imx_soc_device_init(void)
|
||||
ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat);
|
||||
if (IS_ERR(ocotp))
|
||||
pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
|
||||
}
|
||||
|
||||
if (!IS_ERR_OR_NULL(ocotp)) {
|
||||
regmap_read(ocotp, OCOTP_UID_H, &val);
|
||||
soc_uid = val;
|
||||
regmap_read(ocotp, OCOTP_UID_L, &val);
|
||||
|
Loading…
Reference in New Issue
Block a user