]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mfd: tps6586x: Fix OF node refcount
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thu, 21 May 2026 08:36:24 +0000 (10:36 +0200)
committerLee Jones <lee@kernel.org>
Wed, 17 Jun 2026 10:32:56 +0000 (11:32 +0100)
Platform devices created with platform_device_alloc() call
platform_device_release() when the last reference to the device's
kobject is dropped. This function calls of_node_put() unconditionally.
This works fine for devices created with platform_device_register_full()
but users of the split approach (platform_device_alloc() +
platform_device_add()) must bump the reference of the of_node they
assign manually. Add the missing call to of_node_get().

Cc: stable@vger.kernel.org
Fixes: 62f6b0879304 ("tps6586x: Add device tree support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260521-pdev-fwnode-ref-v1-1-88c324a1b8d2@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/tps6586x.c

index 8d5fe2b60bfa550d0aad30acd0820fac354028ac..f5f805446603315ba76ce1fc501c908f1cec0d16 100644 (file)
@@ -397,7 +397,7 @@ static int tps6586x_add_subdevs(struct tps6586x *tps6586x,
 
                pdev->dev.parent = tps6586x->dev;
                pdev->dev.platform_data = subdev->platform_data;
-               pdev->dev.of_node = subdev->of_node;
+               pdev->dev.of_node = of_node_get(subdev->of_node);
 
                ret = platform_device_add(pdev);
                if (ret) {