mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] blspec: Fix when NFS is not enabled
       [not found] <1393599567-20329-1-git-send-email-philippe.retornaz@epfl.ch>
@ 2014-03-03  7:13 ` Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2014-03-03  7:13 UTC (permalink / raw)
  To: Philippe Rétornaz; +Cc: barebox

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-03  7:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1393599567-20329-1-git-send-email-philippe.retornaz@epfl.ch>
2014-03-03  7:13 ` [PATCH 1/1] blspec: Fix when NFS is not enabled Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox