fixed error checking

This commit is contained in:
Markus Fröschle
2013-07-18 13:11:52 +00:00
parent 8316c31f2a
commit 0fe44c5f1d

View File

@@ -185,12 +185,26 @@ uint32_t xhdi_driver_special(uint32_t key1, uint32_t key2, uint16_t subopcode, v
uint32_t xhdi_get_capacity(uint16_t major, uint16_t minor, uint32_t *blocks, uint32_t *bs) uint32_t xhdi_get_capacity(uint16_t major, uint16_t minor, uint32_t *blocks, uint32_t *bs)
{ {
if (major == MY_MAJOR) if (major == MY_MAJOR)
{
if (blocks != 0)
{ {
if (disk_ioctl(0, GET_SECTOR_COUNT, blocks) != RES_OK) if (disk_ioctl(0, GET_SECTOR_COUNT, blocks) != RES_OK)
{
xprintf("disk_ioctl(0, GET_SECTOR_COUNT, %p) failed in xhdi_get_capacity()\r\n");
return ERROR; return ERROR;
}
}
if (bs != 0)
{
if (disk_ioctl(0, GET_SECTOR_SIZE, bs) != RES_OK) if (disk_ioctl(0, GET_SECTOR_SIZE, bs) != RES_OK)
{
xprintf("disk_ioctl(0, GET_SECTOR_SIZE, %p) failed in xhdi_get_capacity()\r\n");
return ERROR; return ERROR;
*bs = 512; }
}
return E_OK; return E_OK;
} }
return EUNDEV; return EUNDEV;