of: fix missing kobject init for !SYSFS && OF_DYNAMIC config
authorRob Herring <robh@kernel.org>
Tue, 21 Apr 2020 12:40:16 +0000 (13:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Apr 2020 05:59:10 +0000 (07:59 +0200)
[ Upstream commit bd82bbf38cbe27f2c65660da801900d71bcc5cc8 ]

The ref counting is broken for OF_DYNAMIC when sysfs is disabled because
the kobject initialization is skipped. Only the properties
add/remove/update should be skipped for !SYSFS config.

Tested-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/base.c

index c66cdc4307fd7d1107b94e6166eabd1818c0af7f..af80e3d34eda74a92800c23d7208d3253dc9a54e 100644 (file)
@@ -170,9 +170,6 @@ int __of_attach_node_sysfs(struct device_node *np)
        struct property *pp;
        int rc;
 
-       if (!IS_ENABLED(CONFIG_SYSFS))
-               return 0;
-
        if (!of_kset)
                return 0;