1

pwm: ntxec: Use device_set_of_node_from_dev()

Compared to overwriting pdev->dev.of_node directly, this takes care of
reference counting. It also prevents that the parent device matches this
driver. See commit 9b22c17a3c ("of: Check 'of_node_reused' flag on
of_match_device()") for further details.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
Uwe Kleine-König 2023-07-18 19:53:10 +02:00 committed by Thierry Reding
parent 250b4ca0c9
commit 387c74e5f9

View File

@ -140,7 +140,7 @@ static int ntxec_pwm_probe(struct platform_device *pdev)
struct ntxec_pwm *priv;
struct pwm_chip *chip;
pdev->dev.of_node = pdev->dev.parent->of_node;
device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)