Changes in uspace/drv/block/usbmast/scsi_ms.c [b7fd2a0:ae3a941] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/usbmast/scsi_ms.c
rb7fd2a0 rae3a941 2 2 * Copyright (c) 2011 Vojtech Horky 3 3 * Copyright (c) 2011 Jiri Svoboda 4 * Copyright (c) 2018 Ondrej Hlavaty 4 5 * All rights reserved. 5 6 * … … 87 88 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 88 89 89 90 if (rc != EOK) { 90 91 usb_log_error("Test Unit Ready failed on device %s: %s.", 91 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));92 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 92 93 return rc; 93 94 } … … 97 98 if (cmd.status != CMDS_GOOD) 98 99 usb_log_warning("Test Unit Ready command failed on device %s.", 99 usb_device_get_name(mfun->mdev->usb_dev));100 usb_device_get_name(mfun->mdev->usb_dev)); 100 101 101 102 return EOK; … … 116 117 rc = usb_massstor_unit_ready(mfun); 117 118 if (rc != EOK) { 118 usb_log_error("Inquiry transport failed, device %s: %s. \n",119 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));119 usb_log_error("Inquiry transport failed, device %s: %s.", 120 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 120 121 return rc; 121 122 } … … 123 124 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd); 124 125 if (rc != EOK) { 125 usb_log_error("Inquiry transport failed, device %s: %s. \n",126 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));126 usb_log_error("Inquiry transport failed, device %s: %s.", 127 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 127 128 return rc; 128 129 } … … 131 132 return EOK; 132 133 133 usb_log_error("SCSI command failed, device %s. \n",134 usb_log_error("SCSI command failed, device %s.", 134 135 usb_device_get_name(mfun->mdev->usb_dev)); 135 136 136 137 rc = usbmast_request_sense(mfun, &sense_buf, sizeof(sense_buf)); 137 138 if (rc != EOK) { 138 usb_log_error("Failed to read sense data. \n");139 usb_log_error("Failed to read sense data."); 139 140 return EIO; 140 141 } … … 182 183 183 184 if (rc != EOK) { 184 usb_log_error("Inquiry transport failed, device %s: %s. \n",185 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));185 usb_log_error("Inquiry transport failed, device %s: %s.", 186 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 186 187 return rc; 187 188 } 188 189 189 190 if (cmd.status != CMDS_GOOD) { 190 usb_log_error("Inquiry command failed, device %s. \n",191 usb_device_get_name(mfun->mdev->usb_dev));191 usb_log_error("Inquiry command failed, device %s.", 192 usb_device_get_name(mfun->mdev->usb_dev)); 192 193 return EIO; 193 194 } 194 195 195 196 if (cmd.rcvd_size < SCSI_STD_INQUIRY_DATA_MIN_SIZE) { 196 usb_log_error("SCSI Inquiry response too short (%zu). \n",197 cmd.rcvd_size);197 usb_log_error("SCSI Inquiry response too short (%zu).", 198 cmd.rcvd_size); 198 199 return EIO; 199 200 } … … 249 250 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 250 251 251 252 usb_log_error("Request Sense failed, device %s: %s. \n",253 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));252 if (rc != EOK || cmd.status != CMDS_GOOD) { 253 usb_log_error("Request Sense failed, device %s: %s.", 254 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 254 255 return rc; 255 256 } … … 291 292 rc = usbmast_run_cmd(mfun, &cmd); 292 293 293 294 usb_log_error("Read Capacity (10) transport failed, device %s: %s. \n",295 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));294 if (rc != EOK) { 295 usb_log_error("Read Capacity (10) transport failed, device %s: %s.", 296 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 296 297 return rc; 297 298 } 298 299 299 300 if (cmd.status != CMDS_GOOD) { 300 usb_log_error("Read Capacity (10) command failed, device %s. \n",301 usb_device_get_name(mfun->mdev->usb_dev));301 usb_log_error("Read Capacity (10) command failed, device %s.", 302 usb_device_get_name(mfun->mdev->usb_dev)); 302 303 return EIO; 303 304 } 304 305 305 306 if (cmd.rcvd_size < sizeof(data)) { 306 usb_log_error("SCSI Read Capacity response too short (%zu). \n",307 cmd.rcvd_size);307 usb_log_error("SCSI Read Capacity response too short (%zu).", 308 cmd.rcvd_size); 308 309 return EIO; 309 310 } … … 349 350 350 351 if (rc != EOK) { 351 usb_log_error("Read (10) transport failed, device %s: %s. \n",352 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));352 usb_log_error("Read (10) transport failed, device %s: %s.", 353 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 353 354 return rc; 354 355 } 355 356 356 357 if (cmd.status != CMDS_GOOD) { 357 usb_log_error("Read (10) command failed, device %s. \n",358 usb_device_get_name(mfun->mdev->usb_dev));358 usb_log_error("Read (10) command failed, device %s.", 359 usb_device_get_name(mfun->mdev->usb_dev)); 359 360 return EIO; 360 361 } 361 362 362 363 if (cmd.rcvd_size < nblocks * mfun->block_size) { 363 usb_log_error("SCSI Read response too short (%zu). \n",364 usb_log_error("SCSI Read response too short (%zu).", 364 365 cmd.rcvd_size); 365 366 return EIO; … … 404 405 rc = usbmast_run_cmd(mfun, &cmd); 405 406 406 407 usb_log_error("Write (10) transport failed, device %s: %s. \n",408 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));407 if (rc != EOK) { 408 usb_log_error("Write (10) transport failed, device %s: %s.", 409 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 409 410 return rc; 410 411 } 411 412 412 413 if (cmd.status != CMDS_GOOD) { 413 usb_log_error("Write (10) command failed, device %s. \n",414 usb_device_get_name(mfun->mdev->usb_dev));414 usb_log_error("Write (10) command failed, device %s.", 415 usb_device_get_name(mfun->mdev->usb_dev)); 415 416 return EIO; 416 417 } … … 449 450 const errno_t rc = usbmast_run_cmd(mfun, &cmd); 450 451 451 452 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s. \n",453 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));452 if (rc != EOK) { 453 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.", 454 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 454 455 return rc; 455 456 } 456 457 457 458 if (cmd.status != CMDS_GOOD) { 458 usb_log_error("Synchronize Cache (10) command failed, device %s. \n",459 usb_device_get_name(mfun->mdev->usb_dev));459 usb_log_error("Synchronize Cache (10) command failed, device %s.", 460 usb_device_get_name(mfun->mdev->usb_dev)); 460 461 return EIO; 461 462 }
Note:
See TracChangeset
for help on using the changeset viewer.