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 <[email protected]>
> ---
>  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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to