mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
loaders: fix open_ih return value checks
open_ih() returns -1 on error and 0 is a valid return value. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@839 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -81,8 +81,9 @@ aout_load(struct sys_info *info, ihandle_t dev)
|
|||||||
feval("0 state-valid !");
|
feval("0 state-valid !");
|
||||||
|
|
||||||
fd = open_ih(dev);
|
fd = open_ih(dev);
|
||||||
if (!fd)
|
if (fd == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
for (offset = 0; offset < 16 * 512; offset += 512) {
|
for (offset = 0; offset < 16 * 512; offset += 512) {
|
||||||
seek_io(fd, offset);
|
seek_io(fd, offset);
|
||||||
|
|||||||
@@ -383,8 +383,9 @@ elf_load(struct sys_info *info, ihandle_t dev, const char *cmdline, void **boot_
|
|||||||
feval("0 state-valid !");
|
feval("0 state-valid !");
|
||||||
|
|
||||||
fd = open_ih(dev);
|
fd = open_ih(dev);
|
||||||
if (!fd)
|
if (fd == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
offset = find_elf(&ehdr);
|
offset = find_elf(&ehdr);
|
||||||
if (!offset) {
|
if (!offset) {
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ fcode_load(ihandle_t dev)
|
|||||||
feval("0 state-valid !");
|
feval("0 state-valid !");
|
||||||
|
|
||||||
fd = open_ih(dev);
|
fd = open_ih(dev);
|
||||||
if (!fd)
|
if (fd == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
for (offset = 0; offset < 16 * 512; offset += 512) {
|
for (offset = 0; offset < 16 * 512; offset += 512) {
|
||||||
seek_io(fd, offset);
|
seek_io(fd, offset);
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ int forth_load(ihandle_t dev)
|
|||||||
feval("0 state-valid !");
|
feval("0 state-valid !");
|
||||||
|
|
||||||
fd = open_ih(dev);
|
fd = open_ih(dev);
|
||||||
if (!fd)
|
if (fd == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (read_io(fd, magic, 2) != 2) {
|
if (read_io(fd, magic, 2) != 2) {
|
||||||
debug("Can't read magic header\n");
|
debug("Can't read magic header\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user