mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/8] bootstrap_read_devfs(): Check for errors from devfs_add_partition()
Date: Mon, 4 May 2015 09:35:45 +0200	[thread overview]
Message-ID: <20150504073545.GP6325@pengutronix.de> (raw)
In-Reply-To: <1430683999-5910-3-git-send-email-andrew.smirnov@gmail.com>

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@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 |

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

  reply	other threads:[~2015-05-04  7:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-03 20:13 [PATCH 1/8] Makefile.lib: Fix i.MX image size after generation Andrey Smirnov
2015-05-03 20:13 ` [PATCH 2/8] bootstrap: Fix potential memory leak in 'read_image_head' Andrey Smirnov
2015-05-03 20:13 ` [PATCH 3/8] bootstrap_read_devfs(): Check for errors from devfs_add_partition() Andrey Smirnov
2015-05-04  7:35   ` Sascha Hauer [this message]
2015-05-03 20:13 ` [PATCH 4/8] bootstrap_read_devfs(): Close file after we are done with it Andrey Smirnov
2015-05-03 20:13 ` [PATCH 5/8] bootstrap_read_devfs(): Fix potential memory leak Andrey Smirnov
2015-05-03 20:13 ` [PATCH 6/8] bootstrap_read_devfs(): Check for errors from dev_add_bb_dev() Andrey Smirnov
2015-05-03 20:13 ` [PATCH 7/8] bootstrap_read_devfs(): Remove all partitions upon function completion Andrey Smirnov
2015-05-03 20:13 ` [PATCH 8/8] bootstrap: Warn if image size in BB header is zero Andrey Smirnov
2015-05-03 20:28 ` [PATCH 1/8] Makefile.lib: Fix i.MX image size after generation Marc Kleine-Budde
2015-05-03 21:49   ` Andrey Smirnov

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=20150504073545.GP6325@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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