From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHlMx-0003xv-Bx for barebox@lists.infradead.org; Mon, 14 Sep 2020 10:05:58 +0000 From: Ahmad Fatoum Date: Mon, 14 Sep 2020 12:05:47 +0200 Message-Id: <20200914100553.24808-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 master 1/7] sandbox: hostfile: error out if file couldn't be opened To: barebox@lists.infradead.org Cc: Ahmad Fatoum The file descriptor is mandatory for doing anything useful. Error out if we don't have one. Signed-off-by: Ahmad Fatoum --- arch/sandbox/board/hostfile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 5f0d7e0a4b28..56023b4ad45d 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -91,6 +91,9 @@ static int hf_probe(struct device_d *dev) if (!priv->fd) priv->fd = linux_open(priv->filename, true); + if (priv->fd < 0) + return priv->fd; + priv->cdev.name = dev->device_node->name; priv->cdev.dev = dev; priv->cdev.ops = &hf_fops; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox