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

Merge tag 'versatile-soc-for-v6.12' of https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator into soc/drivers

Some long due cleanups and modernizations of the Versatile
SoC drivers from Krzysztof:

- Put OF handle
- Use devres to avoid memory leaks
- Enable compile testing

* tag 'versatile-soc-for-v6.12' of https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator:
soc: versatile: enable compile testing
soc: versatile: realview: fix soc_dev leak during device remove
soc: versatile: realview: fix memory leak during device remove
soc: versatile: integrator: fix OF node leak in probe() error path

Link: https://lore.kernel.org/r/CACRpkda244rFHnnXPDPOhmKiJsRP08tNCcfFzpH5zR2cx1DFpw@mail.gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+20 -7
+1 -1
drivers/soc/Makefile
··· 32 32 obj-$(CONFIG_ARCH_TEGRA) += tegra/ 33 33 obj-y += ti/ 34 34 obj-$(CONFIG_ARCH_U8500) += ux500/ 35 - obj-$(CONFIG_PLAT_VERSATILE) += versatile/ 35 + obj-y += versatile/ 36 36 obj-y += xilinx/
+2 -2
drivers/soc/versatile/Kconfig
··· 4 4 # 5 5 config SOC_INTEGRATOR_CM 6 6 bool "SoC bus device for the ARM Integrator platform core modules" 7 - depends on ARCH_INTEGRATOR 7 + depends on ARCH_INTEGRATOR || COMPILE_TEST 8 8 select SOC_BUS 9 9 help 10 10 Include support for the SoC bus on the ARM Integrator platform ··· 13 13 14 14 config SOC_REALVIEW 15 15 bool "SoC bus device for the ARM RealView platforms" 16 - depends on ARCH_REALVIEW 16 + depends on ARCH_REALVIEW || COMPILE_TEST 17 17 select SOC_BUS 18 18 help 19 19 Include support for the SoC bus on the ARM RealView platforms
+1
drivers/soc/versatile/soc-integrator.c
··· 113 113 return -ENODEV; 114 114 115 115 syscon_regmap = syscon_node_to_regmap(np); 116 + of_node_put(np); 116 117 if (IS_ERR(syscon_regmap)) 117 118 return PTR_ERR(syscon_regmap); 118 119
+16 -4
drivers/soc/versatile/soc-realview.c
··· 4 4 * 5 5 * Author: Linus Walleij <linus.walleij@linaro.org> 6 6 */ 7 + #include <linux/device.h> 7 8 #include <linux/init.h> 8 9 #include <linux/io.h> 9 10 #include <linux/slab.h> ··· 82 81 83 82 ATTRIBUTE_GROUPS(realview); 84 83 84 + static void realview_soc_socdev_release(void *data) 85 + { 86 + struct soc_device *soc_dev = data; 87 + 88 + soc_device_unregister(soc_dev); 89 + } 90 + 85 91 static int realview_soc_probe(struct platform_device *pdev) 86 92 { 87 93 struct regmap *syscon_regmap; ··· 101 93 if (IS_ERR(syscon_regmap)) 102 94 return PTR_ERR(syscon_regmap); 103 95 104 - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 96 + soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERNEL); 105 97 if (!soc_dev_attr) 106 98 return -ENOMEM; 107 99 ··· 114 106 soc_dev_attr->family = "Versatile"; 115 107 soc_dev_attr->custom_attr_group = realview_groups[0]; 116 108 soc_dev = soc_device_register(soc_dev_attr); 117 - if (IS_ERR(soc_dev)) { 118 - kfree(soc_dev_attr); 109 + if (IS_ERR(soc_dev)) 119 110 return -ENODEV; 120 - } 111 + 112 + ret = devm_add_action_or_reset(&pdev->dev, realview_soc_socdev_release, 113 + soc_dev); 114 + if (ret) 115 + return ret; 116 + 121 117 ret = regmap_read(syscon_regmap, REALVIEW_SYS_ID_OFFSET, 122 118 &realview_coreid); 123 119 if (ret)