]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc: Update of_remove_property() call sites to remove null checking
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Thu, 28 Apr 2016 05:34:55 +0000 (15:34 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 11 May 2016 11:54:04 +0000 (21:54 +1000)
After obtaining a property from of_find_property() and before calling
of_remove_property() most code checks to ensure that the property
returned from of_find_property() is not null. The previous patch moved
this check to the start of the function of_remove_property() in order to
avoid the case where this check isn't done and a null value is passed.
This ensures the check is always conducted before taking locks and
attempting to remove the property. Thus it is no longer necessary to
perform a check for null values before invoking of_remove_property().

Update of_remove_property() call sites in order to remove redundant
checking for null property value as check is now performed within the
of_remove_property function().

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[mpe: Unbreak some lines which are just >80 chars for readability]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/machine_kexec_64.c
arch/powerpc/platforms/pseries/mobility.c
arch/powerpc/platforms/pseries/reconfig.c

index 015ae55c18686ffb794938531aa52692e0843b0e..2694d078741d08c9f32a05c7ea6323867ddde63d 100644 (file)
@@ -228,17 +228,12 @@ static struct property memory_limit_prop = {
 
 static void __init export_crashk_values(struct device_node *node)
 {
-       struct property *prop;
-
        /* There might be existing crash kernel properties, but we can't
         * be sure what's in them, so remove them. */
-       prop = of_find_property(node, "linux,crashkernel-base", NULL);
-       if (prop)
-               of_remove_property(node, prop);
-
-       prop = of_find_property(node, "linux,crashkernel-size", NULL);
-       if (prop)
-               of_remove_property(node, prop);
+       of_remove_property(node, of_find_property(node,
+                               "linux,crashkernel-base", NULL));
+       of_remove_property(node, of_find_property(node,
+                               "linux,crashkernel-size", NULL));
 
        if (crashk_res.start != 0) {
                crashk_base = cpu_to_be_ulong(crashk_res.start),
@@ -258,16 +253,13 @@ static void __init export_crashk_values(struct device_node *node)
 static int __init kexec_setup(void)
 {
        struct device_node *node;
-       struct property *prop;
 
        node = of_find_node_by_path("/chosen");
        if (!node)
                return -ENOENT;
 
        /* remove any stale properties so ours can be found */
-       prop = of_find_property(node, kernel_end_prop.name, NULL);
-       if (prop)
-               of_remove_property(node, prop);
+       of_remove_property(node, of_find_property(node, kernel_end_prop.name, NULL));
 
        /* information needed by userspace when using default_machine_kexec */
        kernel_end = cpu_to_be_ulong(__pa(_end));
index 1da864c00db0fbbee88cd0c08bd410b68de37897..b8c202d63ecb83d9a1afded686af1c268e2c4cb6 100644 (file)
@@ -403,7 +403,6 @@ static struct property htab_size_prop = {
 static int __init export_htab_values(void)
 {
        struct device_node *node;
-       struct property *prop;
 
        /* On machines with no htab htab_address is NULL */
        if (!htab_address)
@@ -414,12 +413,8 @@ static int __init export_htab_values(void)
                return -ENODEV;
 
        /* remove any stale propertys so ours can be found */
-       prop = of_find_property(node, htab_base_prop.name, NULL);
-       if (prop)
-               of_remove_property(node, prop);
-       prop = of_find_property(node, htab_size_prop.name, NULL);
-       if (prop)
-               of_remove_property(node, prop);
+       of_remove_property(node, of_find_property(node, htab_base_prop.name, NULL));
+       of_remove_property(node, of_find_property(node, htab_size_prop.name, NULL));
 
        htab_base = cpu_to_be64(__pa(htab_address));
        of_add_property(node, &htab_base_prop);
index ceb18d34945978d9bc357dce09800882f27dc83a..a560a98bcf3bc2552486b552ef8e8a887425f0ba 100644 (file)
@@ -191,8 +191,8 @@ static int update_dt_node(__be32 phandle, s32 scope)
                                break;
 
                        case 0x80000000:
-                               prop = of_find_property(dn, prop_name, NULL);
-                               of_remove_property(dn, prop);
+                               of_remove_property(dn, of_find_property(dn,
+                                                       prop_name, NULL));
                                prop = NULL;
                                break;
 
index 7c7fcc04254948837a3a747ef83fd6cdd6babb3b..cc66c49f07aa1b8a6825382216efb38486665460 100644 (file)
@@ -303,7 +303,6 @@ static int do_remove_property(char *buf, size_t bufsize)
 {
        struct device_node *np;
        char *tmp;
-       struct property *prop;
        buf = parse_node(buf, bufsize, &np);
 
        if (!np)
@@ -316,9 +315,7 @@ static int do_remove_property(char *buf, size_t bufsize)
        if (strlen(buf) == 0)
                return -EINVAL;
 
-       prop = of_find_property(np, buf, NULL);
-
-       return of_remove_property(np, prop);
+       return of_remove_property(np, of_find_property(np, buf, NULL));
 }
 
 static int do_update_property(char *buf, size_t bufsize)