2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>

* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Check device type before
	opening and not after.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-13 16:44:34 +01:00
parent 69e137e819
commit 5b59a4e367
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Check device type before
opening and not after.
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Macroify

View File

@ -172,16 +172,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
grub_dprintf ("disk", "Opening `%s'.\n", op->devpath);
grub_ieee1275_open (op->devpath, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
grub_dprintf ("disk", "Opened `%s' as handle %p.\n", op->devpath,
(void *) (unsigned long) dev_ihandle);
if (grub_ieee1275_finddevice (op->devpath, &dev))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read device properties");
@ -201,6 +191,16 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
goto fail;
}
grub_ieee1275_open (op->devpath, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
grub_dprintf ("disk", "Opened `%s' as handle %p.\n", op->devpath,
(void *) (unsigned long) dev_ihandle);
/* XXX: There is no property to read the number of blocks. There
should be a property `#blocks', but it is not there. Perhaps it
is possible to use seek for this. */