From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yp0HI-0001up-0y for barebox@lists.infradead.org; Sun, 03 May 2015 20:14:16 +0000 Received: by pdbqa5 with SMTP id qa5so145082893pdb.1 for ; Sun, 03 May 2015 13:13:55 -0700 (PDT) From: Andrey Smirnov Date: Sun, 3 May 2015 13:13:14 -0700 Message-Id: <1430683999-5910-3-git-send-email-andrew.smirnov@gmail.com> In-Reply-To: <1430683999-5910-1-git-send-email-andrew.smirnov@gmail.com> References: <1430683999-5910-1-git-send-email-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 3/8] bootstrap_read_devfs(): Check for errors from devfs_add_partition() To: barebox@lists.infradead.org Cc: Andrey Smirnov Check for errors returned by devfs_add_partition() and bail if there are any. Signed-off-by: Andrey Smirnov --- 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)) { + bootstrap_err("%s: failed to add partition (%ld)\n", + devname, PTR_ERR(partition)); + return NULL; + } + if (use_bb) { dev_add_bb_dev(partname, "bbx"); partname = "bbx"; -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox