devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Dong Aisheng <b29396@freescale.com>
Cc: devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, rob.herring@calxeda.com
Subject: Re: [PATCH 1/1] of: add NULL parameter check for of_device_is_available
Date: Tue, 13 Mar 2012 07:46:15 -0500	[thread overview]
Message-ID: <4F5F4197.4070605@gmail.com> (raw)
In-Reply-To: <1331638805-17136-1-git-send-email-b29396@freescale.com>

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;

  reply	other threads:[~2012-03-13 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 11:40 [PATCH 1/1] of: add NULL parameter check for of_device_is_available Dong Aisheng
2012-03-13 12:46 ` Rob Herring [this message]
2012-03-13 20:34 ` David Miller
2012-03-13 21:15   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F5F4197.4070605@gmail.com \
    --to=robherring2@gmail.com \
    --cc=b29396@freescale.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).