[PATCH v2 3/7] soc: samsung: exynos-chipid: use devm action to unregister soc device
Tudor Ambarus
tudor.ambarus at linaro.org
Tue Nov 18 05:56:10 PST 2025
Simplify the unwinding of the soc device by using a devm action.
Add the action before the exynos_asv_init() to avoid an explicit call
to soc_device_unregister().
Signed-off-by: Tudor Ambarus <tudor.ambarus at linaro.org>
---
drivers/soc/samsung/exynos-chipid.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 8904ffdaf9a6f6d069cc6af18a24dd00a2780892..db73dfad4e1b4fb001cb653bc8caf8aa08d85f2d 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -145,6 +145,11 @@ static struct regmap *exynos_chipid_get_efuse_regmap(struct platform_device *pde
return devm_regmap_init_mmio(&pdev->dev, base, ®_config);
}
+static void exynos_chipid_unregister_soc(void *data)
+{
+ soc_device_unregister(data);
+}
+
static int exynos_chipid_probe(struct platform_device *pdev)
{
const struct exynos_chipid_variant *drv_data;
@@ -207,28 +212,19 @@ static int exynos_chipid_probe(struct platform_device *pdev)
if (IS_ERR(soc_dev))
return PTR_ERR(soc_dev);
- ret = exynos_asv_init(dev, regmap);
+ ret = devm_add_action_or_reset(dev, exynos_chipid_unregister_soc,
+ soc_dev);
if (ret)
- goto err;
+ return dev_err_probe(dev, ret, "failed to add devm action\n");
- platform_set_drvdata(pdev, soc_dev);
+ ret = exynos_asv_init(dev, regmap);
+ if (ret)
+ return ret;
dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
return 0;
-
-err:
- soc_device_unregister(soc_dev);
-
- return ret;
-}
-
-static void exynos_chipid_remove(struct platform_device *pdev)
-{
- struct soc_device *soc_dev = platform_get_drvdata(pdev);
-
- soc_device_unregister(soc_dev);
}
static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
@@ -270,7 +266,6 @@ static struct platform_driver exynos_chipid_driver = {
.of_match_table = exynos_chipid_of_device_ids,
},
.probe = exynos_chipid_probe,
- .remove = exynos_chipid_remove,
};
module_platform_driver(exynos_chipid_driver);
--
2.52.0.rc1.455.g30608eb744-goog
More information about the linux-arm-kernel
mailing list