lkml.org 
[lkml]   [2012]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] of: add NULL parameter check for of_device_is_available
On 03/13/2012 06:40 AM, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> This function will return 1 even the device node passed in
> is NULL which is a little error-prone.
> Change to return 0 if the device node passed in is NULL.
>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>

Applied.

Rob

> ---
> drivers/of/base.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 133908a..b9347d8 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -280,6 +280,9 @@ int of_device_is_available(const struct device_node *device)
> const char *status;
> int statlen;
>
> + if (device == NULL)
> + return 0;
> +
> status = of_get_property(device, "status", &statlen);
> if (status == NULL)
> return 1;



\
 
 \ /
  Last update: 2012-03-13 13:49    [W:0.061 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site