Skip to content

Commit

Permalink
* grub-core/disk/usbms.c (grub_usbms_cbi_cmd): Fix error type. (grub_…
Browse files Browse the repository at this point in the history
…usbms_cbi_reset): Likewise. (grub_usbms_bo_reset): Likewise. (grub_usbms_reset): Likewise. (grub_usbms_attach): Likewise. (grub_usbms_transfer_cbi): Likewise.
  • Loading branch information
phcoder authored and ani-sinha committed Jul 4, 2022
1 parent 0cc0d7a commit 50c22e2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions grub-core/disk/usbms.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef struct grub_usbms_dev *grub_usbms_dev_t;
static grub_usbms_dev_t grub_usbms_devices[MAX_USBMS_DEVICES];
static int first_available_slot = 0;

static grub_err_t
static grub_usb_err_t
grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface,
grub_uint8_t *cbicb)
{
Expand All @@ -86,7 +86,7 @@ grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface,
GRUB_USBMS_CBI_CMD_SIZE, (char*)cbicb);
}

static grub_err_t
static grub_usb_err_t
grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
{
/* Prepare array with Command Block Reset (=CBR) */
Expand All @@ -108,17 +108,17 @@ grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
return grub_usbms_cbi_cmd (dev, interface, (grub_uint8_t *)&cbicb);
}

static grub_err_t
static grub_usb_err_t
grub_usbms_bo_reset (grub_usb_device_t dev, int interface)
{
grub_usb_err_t u;
u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
if (u)
return grub_error (GRUB_ERR_IO, "USB error %d", u);
return GRUB_ERR_NONE;
return u;
return GRUB_USB_ERR_NONE;
}

static grub_err_t
static grub_usb_err_t
grub_usbms_reset (grub_usbms_dev_t dev)
{
if (dev->protocol == GRUB_USBMS_PROTOCOL_BULK)
Expand Down Expand Up @@ -149,7 +149,7 @@ grub_usbms_attach (grub_usb_device_t usbdev, int configno, int interfno)
int j;
grub_uint8_t luns = 0;
unsigned curnum;
grub_usb_err_t err = GRUB_ERR_NONE;
grub_usb_err_t err = GRUB_USB_ERR_NONE;

if (first_available_slot == ARRAY_SIZE (grub_usbms_devices))
return 0;
Expand Down Expand Up @@ -567,7 +567,11 @@ grub_usbms_transfer_cbi (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
}
}

return err;

if (err)
return grub_error (GRUB_ERR_IO, "USB error %d", err);

return GRUB_ERR_NONE;
}


Expand Down

0 comments on commit 50c22e2

Please sign in to comment.