devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: Clean up of_update_property
@ 2014-04-15 15:38 Guenter Roeck
  2014-04-15 20:23 ` Rob Herring
       [not found] ` <1397576297-4785-1-git-send-email-linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2014-04-15 15:38 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Grant Likely, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Guenter Roeck

After searching for the old property, bail out with -ENODEV
if it was not found.

It is unnecessary to check if oldprop is NULL before removing
its binary file; the check was already done before.

Signed-off-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
---
 drivers/of/base.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index f72d19b..6d4ee22 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1828,17 +1828,13 @@ int of_update_property(struct device_node *np, struct property *newprop)
 		next = &(*next)->next;
 	}
 	raw_spin_unlock_irqrestore(&devtree_lock, flags);
-	if (rc)
-		return rc;
+	if (!found)
+		return -ENODEV;
 
 	/* Update the sysfs attribute */
-	if (oldprop)
-		sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
+	sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
 	__of_add_property_sysfs(np, newprop);
 
-	if (!found)
-		return -ENODEV;
-
 	return 0;
 }
 
-- 
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] of: Clean up of_update_property
  2014-04-15 15:38 [PATCH] of: Clean up of_update_property Guenter Roeck
@ 2014-04-15 20:23 ` Rob Herring
       [not found] ` <1397576297-4785-1-git-send-email-linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2014-04-15 20:23 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devicetree@vger.kernel.org, Rob Herring, Grant Likely,
	linux-kernel@vger.kernel.org

On Tue, Apr 15, 2014 at 10:38 AM, Guenter Roeck <linux@roeck-us.net> wrote:
> After searching for the old property, bail out with -ENODEV
> if it was not found.
>
> It is unnecessary to check if oldprop is NULL before removing
> its binary file; the check was already done before.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied. Thanks.

Rob

> ---
>  drivers/of/base.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f72d19b..6d4ee22 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1828,17 +1828,13 @@ int of_update_property(struct device_node *np, struct property *newprop)
>                 next = &(*next)->next;
>         }
>         raw_spin_unlock_irqrestore(&devtree_lock, flags);
> -       if (rc)
> -               return rc;
> +       if (!found)
> +               return -ENODEV;
>
>         /* Update the sysfs attribute */
> -       if (oldprop)
> -               sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> +       sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
>         __of_add_property_sysfs(np, newprop);
>
> -       if (!found)
> -               return -ENODEV;
> -
>         return 0;
>  }
>
> --
> 1.7.9.7
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] of: Clean up of_update_property
       [not found] ` <1397576297-4785-1-git-send-email-linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
@ 2014-04-22 14:39   ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2014-04-22 14:39 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Guenter Roeck

On Tue, 15 Apr 2014 08:38:17 -0700, Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> wrote:
> After searching for the old property, bail out with -ENODEV
> if it was not found.
> 
> It is unnecessary to check if oldprop is NULL before removing
> its binary file; the check was already done before.
> 
> Signed-off-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
> ---
>  drivers/of/base.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f72d19b..6d4ee22 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1828,17 +1828,13 @@ int of_update_property(struct device_node *np, struct property *newprop)
>  		next = &(*next)->next;
>  	}
>  	raw_spin_unlock_irqrestore(&devtree_lock, flags);
> -	if (rc)
> -		return rc;
> +	if (!found)
> +		return -ENODEV;
>  
>  	/* Update the sysfs attribute */
> -	if (oldprop)
> -		sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> +	sysfs_remove_bin_file(&np->kobj, &oldprop->attr);

Hahaha. The funny think is that I had to put this change right back in
when picking up Xiubo's patch. The logic has become slightly different
with his fix though, so it doesn't make this patch incorrect.

g.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-22 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 15:38 [PATCH] of: Clean up of_update_property Guenter Roeck
2014-04-15 20:23 ` Rob Herring
     [not found] ` <1397576297-4785-1-git-send-email-linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-04-22 14:39   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).