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>
This commit is contained in:
@@ -32,5 +32,5 @@ obj-y += sunxi/
|
||||
obj-$(CONFIG_ARCH_TEGRA) += tegra/
|
||||
obj-y += ti/
|
||||
obj-$(CONFIG_ARCH_U8500) += ux500/
|
||||
obj-$(CONFIG_PLAT_VERSATILE) += versatile/
|
||||
obj-y += versatile/
|
||||
obj-y += xilinx/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
config SOC_INTEGRATOR_CM
|
||||
bool "SoC bus device for the ARM Integrator platform core modules"
|
||||
depends on ARCH_INTEGRATOR
|
||||
depends on ARCH_INTEGRATOR || COMPILE_TEST
|
||||
select SOC_BUS
|
||||
help
|
||||
Include support for the SoC bus on the ARM Integrator platform
|
||||
@@ -13,7 +13,7 @@ config SOC_INTEGRATOR_CM
|
||||
|
||||
config SOC_REALVIEW
|
||||
bool "SoC bus device for the ARM RealView platforms"
|
||||
depends on ARCH_REALVIEW
|
||||
depends on ARCH_REALVIEW || COMPILE_TEST
|
||||
select SOC_BUS
|
||||
help
|
||||
Include support for the SoC bus on the ARM RealView platforms
|
||||
|
||||
@@ -113,6 +113,7 @@ static int __init integrator_soc_init(void)
|
||||
return -ENODEV;
|
||||
|
||||
syscon_regmap = syscon_node_to_regmap(np);
|
||||
of_node_put(np);
|
||||
if (IS_ERR(syscon_regmap))
|
||||
return PTR_ERR(syscon_regmap);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* Author: Linus Walleij <linus.walleij@linaro.org>
|
||||
*/
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -81,6 +82,13 @@ static struct attribute *realview_attrs[] = {
|
||||
|
||||
ATTRIBUTE_GROUPS(realview);
|
||||
|
||||
static void realview_soc_socdev_release(void *data)
|
||||
{
|
||||
struct soc_device *soc_dev = data;
|
||||
|
||||
soc_device_unregister(soc_dev);
|
||||
}
|
||||
|
||||
static int realview_soc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct regmap *syscon_regmap;
|
||||
@@ -93,7 +101,7 @@ static int realview_soc_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(syscon_regmap))
|
||||
return PTR_ERR(syscon_regmap);
|
||||
|
||||
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
|
||||
soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERNEL);
|
||||
if (!soc_dev_attr)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -106,10 +114,14 @@ static int realview_soc_probe(struct platform_device *pdev)
|
||||
soc_dev_attr->family = "Versatile";
|
||||
soc_dev_attr->custom_attr_group = realview_groups[0];
|
||||
soc_dev = soc_device_register(soc_dev_attr);
|
||||
if (IS_ERR(soc_dev)) {
|
||||
kfree(soc_dev_attr);
|
||||
if (IS_ERR(soc_dev))
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(&pdev->dev, realview_soc_socdev_release,
|
||||
soc_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = regmap_read(syscon_regmap, REALVIEW_SYS_ID_OFFSET,
|
||||
&realview_coreid);
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user