[PATCH 3/8] bootstrap_read_devfs(): Check for errors from devfs_add_partition()

Sascha Hauer s.hauer at pengutronix.de
Mon May 4 00:35:45 PDT 2015


On Sun, May 03, 2015 at 01:13:14PM -0700, Andrey Smirnov wrote:
> Check for errors returned by devfs_add_partition() and bail if there
> are any.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
> ---
>  lib/bootstrap/devfs.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/bootstrap/devfs.c b/lib/bootstrap/devfs.c
> index 82c7d21..de274a0 100644
> --- a/lib/bootstrap/devfs.c
> +++ b/lib/bootstrap/devfs.c
> @@ -82,10 +82,17 @@ void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
>  	int ret;
>  	int size = 0;
>  	void *to, *header;
> -	struct cdev *cdev;
> +	struct cdev *cdev, partition;
>  	char *partname = "x";
> 
> -	devfs_add_partition(devname, offset, max_size, DEVFS_PARTITION_FIXED, partname);
> +	partition = devfs_add_partition(devname, offset, max_size,
> +					DEVFS_PARTITION_FIXED, partname);
> +	if (IS_ERR_OR_NULL(partition)) {

IS_ERR please. devfs_add_partition() will not return a NULL pointer.

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 |



More information about the barebox mailing list