diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-09-14 12:05:47 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-14 15:50:26 +0200 |
commit | 2ed55f746c4223b5d7dfcddb2aa3029dc8e7439b (patch) | |
tree | 66b878a2d5a086008bad72e68d025fbd610d2266 /arch/sandbox | |
parent | 6555866bd1f1024456075235d9ba434606a31297 (diff) | |
download | barebox-2ed55f746c4223b5d7dfcddb2aa3029dc8e7439b.tar.gz barebox-2ed55f746c4223b5d7dfcddb2aa3029dc8e7439b.tar.xz |
sandbox: hostfile: error out if file couldn't be opened
The file descriptor is mandatory for doing anything useful.
Error out if we don't have one.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/board/hostfile.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 5f0d7e0a4b..56023b4ad4 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; |