regulator: bq257xx: drop confusing configuration of_node
PATCH 1/1 regulator: bq257xx: drop confusing configuration of_node
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.
---
This is a follow-up to the reused OF node imbalance series:
https://lore.kernel.org/lkml/[email protected]/
to address a false-positive Sashiko report.
Johan
drivers/regulator/bq257xx-regulator.c | 2 -- 1 file changed, 2 deletions(-)
drivers/regulator/bq257xx-regulator.c +0 -2
@@ -139,7 +139,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct bq257xx_device *bq =dev_get_drvdata (pdev->dev.parent);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);
@@ -156,7 +155,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 ;
Signature · 1 line
2.52.0
Mark Brown
maintainerQuoted 3 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but still sets the
of_nodefield of the regulator configuration to any prior OF node.
Copying in Chris.
Quoted 50 lines
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_nodeassignment.Signed-off-by Johan Hovold <[email protected]>---
This is a follow-up to the reused OF node imbalance series:
https://lore.kernel.org/lkml/[email protected]/to address a false-positive Sashiko report.
Johan
drivers/regulator/bq257xx-regulator.c | 2 -- 1 file changed, 2 deletions(-)drivers/regulator/bq257xx-regulator.c +0
-2@@ -139,7 +139,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct bq257xx_device *bq =dev_get_drvdata (pdev->dev.parent);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);@@ -156,7 +155,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 ;Signature · 1 line
2.52.0
Mark Brown
maintainerQuoted 6 lines · Mark Brown
Quoted 3 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but still sets the
of_nodefield of the regulator configuration to any prior OF node.Copying in Chris.
Or not since hotmail is blocking kernel.org.
Quoted 17 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but still sets the
of_nodefield 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_nodeassignment.
Quoted 7 lines
---
This is a follow-up to the reused OF node imbalance series:
https://lore.kernel.org/lkml/[email protected]/to address a false-positive Sashiko report.
Can this one be picked up now?
Johan
Mark Brown
maintainerQuoted 7 lines · Johan Hovold
Quoted 3 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but still sets the
of_nodefield of the regulator configuration to any prior OF node.Can this one be picked up now?
I have no idea what it was supposed to be applied against.
Quoted 10 lines · Mark Brown
Quoted 7 lines · Johan Hovold
Quoted 3 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but still sets the
of_nodefield of the regulator configuration to any prior OF node.Can this one be picked up now?
I have no idea what it was supposed to be applied against.
Since it does not fix a bug it can go in your regulator for-next branch.
Johan
Mark Brown
maintainerQuoted 5 lines · Johan Hovold
Quoted 1 line · Mark Brown
I have no idea what it was supposed to be applied against.
Since it does not fix a bug it can go in your regulator for-next branch.
No, I mean in the technical sense that I couldn't work out something that the git am operation worked on.