]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regulator: bq257xx: drop confusing configuration of_node
authorJohan Hovold <johan@kernel.org>
Thu, 4 Jun 2026 11:59:12 +0000 (13:59 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 4 Jun 2026 15:59:39 +0000 (16:59 +0100)
The driver reuses the OF node of the parent multi-function device but
still sets the of_node field of the regulator configuration to any prior
OF node.

Since the MFD child device does not have an OF node set until probe is
called, this field is set to NULL on first probe and to the reused OF
node if the driver is later rebound.

As the device_set_of_node_from_dev() helper drops a reference to any
prior OF node before taking a reference to the new one this can
apparently also confuse LLMs like Sashiko which flags it as a potential
use-after-free (which it is not).

Drop the confusing and redundant configuration of_node assignment.

Link: https://sashiko.dev/#/patchset/20260408073055.5183-1-johan%40kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260604115912.2734074-1-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/bq257xx-regulator.c

index 09c466052c0487b346c9482c86ec68b310d0e479..577b277efd7fc37d3f642da9afbc3c391b517631 100644 (file)
@@ -143,7 +143,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct bq257xx_reg_data *pdata;
-       struct device_node *np = dev->of_node;
        struct regulator_config cfg = {};
 
        device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
@@ -159,7 +158,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
 
        cfg.dev = &pdev->dev;
        cfg.driver_data = pdata;
-       cfg.of_node = np;
        cfg.regmap = dev_get_regmap(pdev->dev.parent, NULL);
        if (!cfg.regmap)
                return -ENODEV;