mirror of
https://xff.cz/git/u-boot/
synced 2025-09-27 13:31:16 +02:00
dm: scsi: Adjust return value of scsi_exec()
Change this function to return an error number instead of true/false. This allows us to return a proper error number. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -960,14 +960,14 @@ static int ahci_scsi_exec(struct udevice *dev, struct scsi_cmd *pccb)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unsupport SCSI command 0x%02x\n", pccb->cmd[0]);
|
printf("Unsupport SCSI command 0x%02x\n", pccb->cmd[0]);
|
||||||
return false;
|
return -ENOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("SCSI command 0x%02x ret errno %d\n", pccb->cmd[0], ret);
|
debug("SCSI command 0x%02x ret errno %d\n", pccb->cmd[0], ret);
|
||||||
return false;
|
return ret;
|
||||||
}
|
}
|
||||||
return true;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -368,7 +368,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb,
|
|||||||
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
||||||
|
|
||||||
pccb->datalen = 8;
|
pccb->datalen = 8;
|
||||||
if (scsi_exec(dev, pccb) != true)
|
if (scsi_exec(dev, pccb))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
*capacity = ((lbaint_t)pccb->pdata[0] << 24) |
|
*capacity = ((lbaint_t)pccb->pdata[0] << 24) |
|
||||||
@@ -393,7 +393,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb,
|
|||||||
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
||||||
|
|
||||||
pccb->datalen = 16;
|
pccb->datalen = 16;
|
||||||
if (scsi_exec(dev, pccb) != true)
|
if (scsi_exec(dev, pccb))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
*capacity = ((uint64_t)pccb->pdata[0] << 56) |
|
*capacity = ((uint64_t)pccb->pdata[0] << 56) |
|
||||||
@@ -499,7 +499,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
|
|||||||
pccb->pdata = (unsigned char *)&tempbuff;
|
pccb->pdata = (unsigned char *)&tempbuff;
|
||||||
pccb->datalen = 512;
|
pccb->datalen = 512;
|
||||||
scsi_setup_inquiry(pccb);
|
scsi_setup_inquiry(pccb);
|
||||||
if (scsi_exec(dev, pccb) != true) {
|
if (scsi_exec(dev, pccb)) {
|
||||||
if (pccb->contr_stat == SCSI_SEL_TIME_OUT) {
|
if (pccb->contr_stat == SCSI_SEL_TIME_OUT) {
|
||||||
/*
|
/*
|
||||||
* selection timeout => assuming no
|
* selection timeout => assuming no
|
||||||
@@ -530,7 +530,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
|
|||||||
|
|
||||||
pccb->datalen = 0;
|
pccb->datalen = 0;
|
||||||
scsi_setup_test_unit_ready(pccb);
|
scsi_setup_test_unit_ready(pccb);
|
||||||
if (scsi_exec(dev, pccb) != true) {
|
if (scsi_exec(dev, pccb)) {
|
||||||
if (dev_desc->removable) {
|
if (dev_desc->removable) {
|
||||||
dev_desc->type = perq;
|
dev_desc->type = perq;
|
||||||
goto removable;
|
goto removable;
|
||||||
|
Reference in New Issue
Block a user