Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: fsl: guts: don't access of_root directly

Don't access of_root directly as it reduces the build test coverage for
this driver with COMPILE_TEST=y and OF=n. Use existing helper functions
to retrieve the relevant information.

Suggested-by: Rob Herring <robh@kernel.org>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Acked-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260223-soc-of-root-v2-5-b45da45903c8@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
db0622ef 030706e9

+3 -9
+3 -9
drivers/soc/fsl/guts.c
··· 186 186 const struct fsl_soc_data *soc_data; 187 187 const struct of_device_id *match; 188 188 struct ccsr_guts __iomem *regs; 189 - const char *machine = NULL; 190 189 struct device_node *np; 191 190 bool little_endian; 192 191 u64 soc_uid = 0; ··· 216 217 if (!soc_dev_attr) 217 218 return -ENOMEM; 218 219 219 - if (of_property_read_string(of_root, "model", &machine)) 220 - of_property_read_string_index(of_root, "compatible", 0, &machine); 221 - if (machine) { 222 - soc_dev_attr->machine = kstrdup(machine, GFP_KERNEL); 223 - if (!soc_dev_attr->machine) 224 - goto err_nomem; 225 - } 220 + ret = soc_attr_read_machine(soc_dev_attr); 221 + if (ret) 222 + of_machine_read_compatible(&soc_dev_attr->machine, 0); 226 223 227 224 soc_die = fsl_soc_die_match(svr, fsl_soc_die); 228 225 if (soc_die) { ··· 262 267 err_nomem: 263 268 ret = -ENOMEM; 264 269 err: 265 - kfree(soc_dev_attr->machine); 266 270 kfree(soc_dev_attr->family); 267 271 kfree(soc_dev_attr->soc_id); 268 272 kfree(soc_dev_attr->revision);