From 01a658660126b58562906bd4b368a742a2a92390 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Wed, 22 Jul 2026 02:16:00 +0300 Subject: [PATCH] soc: fsl: guts: make fsl_soc_data available after fsl_guts_init() In a future change, struct fsl_soc_data will be extended with methods for performing RCW override. Since this will be performed from a calling context outside fsl_guts_init(), we need to keep track of the soc_data that we determine at fsl_guts_init() time, so we can reference it later. Signed-off-by: Vladimir Oltean Reviewed-by: Ioana Ciornei Link: https://lore.kernel.org/r/20260721231603.67865-7-vladimir.oltean@nxp.com Signed-off-by: Christophe Leroy (CS GROUP) --- drivers/soc/fsl/guts.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 15674c6734c6..c283d44b68a3 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -138,6 +138,7 @@ static const struct fsl_soc_die_attr fsl_soc_die[] = { static struct fsl_soc_guts { struct ccsr_guts __iomem *dcfg_ccsr; + const struct fsl_soc_data *data; bool little_endian; u32 svr; } soc; @@ -231,10 +232,9 @@ static const struct of_device_id fsl_guts_of_match[] = { static int __init fsl_guts_init(void) { - struct soc_device_attribute *soc_dev_attr; + struct soc_device_attribute *soc_dev_attr = NULL; static struct soc_device *soc_dev; const struct fsl_soc_die_attr *soc_die; - const struct fsl_soc_data *soc_data; const struct of_device_id *match; struct device_node *np; u64 soc_uid = 0; @@ -243,12 +243,13 @@ static int __init fsl_guts_init(void) np = of_find_matching_node_and_match(NULL, fsl_guts_of_match, &match); if (!np) return 0; - soc_data = match->data; + soc.data = match->data; soc.dcfg_ccsr = of_iomap(np, DCFG_CCSR); if (!soc.dcfg_ccsr) { of_node_put(np); - return -ENOMEM; + ret = -ENOMEM; + goto err_clear_soc_data; } soc.little_endian = of_property_read_bool(np, "little-endian"); @@ -291,9 +292,9 @@ static int __init fsl_guts_init(void) goto err_free_soc_id; } - if (soc_data) - soc_uid = fsl_guts_get_soc_uid(soc_data->sfp_compat, - soc_data->uid_offset); + if (soc.data) + soc_uid = fsl_guts_get_soc_uid(soc.data->sfp_compat, + soc.data->uid_offset); if (soc_uid) soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); @@ -323,6 +324,8 @@ static int __init fsl_guts_init(void) err_unmap_dcfg_ccsr: iounmap(soc.dcfg_ccsr); soc.dcfg_ccsr = NULL; +err_clear_soc_data: + soc.data = NULL; return ret; }