mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] blspec: Fix when NFS is not enabled
Date: Mon, 3 Mar 2014 08:13:52 +0100	[thread overview]
Message-ID: <20140303071352.GI17250@pengutronix.de> (raw)
In-Reply-To: <1393599567-20329-1-git-send-email-philippe.retornaz@epfl.ch>

Hi Philippe,

On Fri, Feb 28, 2014 at 03:59:27PM +0100, Philippe Rétornaz wrote:
> Commit 0b10801bb (blspec: Add NFS support) broke blspec when NFS is
> disabled as parse_nfs_url() will return NULL.
> 
> So use IS_ERR_OR_NULL() instead of IS_ERR().
> 
> Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
> ---
>  common/blspec.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/blspec.c b/common/blspec.c
> index fcdcc77..8c2b6ca 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -252,7 +252,7 @@ int blspec_scan_directory(struct blspec *blspec, const char *root)
>  	char *entry_default = NULL, *entry_once = NULL, *name, *nfspath = NULL;
>  
>  	nfspath = parse_nfs_url(root);
> -	if (!IS_ERR(nfspath))
> +	if (!IS_ERR_OR_NULL(nfspath))
>  		root = nfspath;

Thanks for catching this. The usage of IS_ERR_OR_NULL is frowned upon in
the Kernel, we shouldn't use it in barebox either. A function should
either return a valid error pointer or NULL for failure, but not both. I
fixed this with changing parse_nfs_url() to:

	if (!IS_ENABLED(CONFIG_FS_NFS))
		return ERR_PTR(-ENOSYS);

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

           reply	other threads:[~2014-03-03  7:14 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1393599567-20329-1-git-send-email-philippe.retornaz@epfl.ch>]

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=20140303071352.GI17250@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=philippe.retornaz@epfl.ch \
    /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