diff options
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_scsih.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index c13efc3268d8..8a9c70f21ecd 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -388,31 +388,34 @@ _scsih_get_sas_address(struct MPT2SAS_ADAPTER *ioc, u16 handle, | |||
388 | Mpi2SasDevicePage0_t sas_device_pg0; | 388 | Mpi2SasDevicePage0_t sas_device_pg0; |
389 | Mpi2ConfigReply_t mpi_reply; | 389 | Mpi2ConfigReply_t mpi_reply; |
390 | u32 ioc_status; | 390 | u32 ioc_status; |
391 | *sas_address = 0; | ||
391 | 392 | ||
392 | if (handle <= ioc->sas_hba.num_phys) { | 393 | if (handle <= ioc->sas_hba.num_phys) { |
393 | *sas_address = ioc->sas_hba.sas_address; | 394 | *sas_address = ioc->sas_hba.sas_address; |
394 | return 0; | 395 | return 0; |
395 | } else | 396 | } |
396 | *sas_address = 0; | ||
397 | 397 | ||
398 | if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, | 398 | if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
399 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { | 399 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
400 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 400 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, |
401 | ioc->name, __FILE__, __LINE__, __func__); | 401 | __FILE__, __LINE__, __func__); |
402 | return -ENXIO; | 402 | return -ENXIO; |
403 | } | 403 | } |
404 | 404 | ||
405 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & | 405 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; |
406 | MPI2_IOCSTATUS_MASK; | 406 | if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { |
407 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | 407 | *sas_address = le64_to_cpu(sas_device_pg0.SASAddress); |
408 | printk(MPT2SAS_ERR_FMT "handle(0x%04x), ioc_status(0x%04x)" | 408 | return 0; |
409 | "\nfailure at %s:%d/%s()!\n", ioc->name, handle, ioc_status, | ||
410 | __FILE__, __LINE__, __func__); | ||
411 | return -EIO; | ||
412 | } | 409 | } |
413 | 410 | ||
414 | *sas_address = le64_to_cpu(sas_device_pg0.SASAddress); | 411 | /* we hit this becuase the given parent handle doesn't exist */ |
415 | return 0; | 412 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) |
413 | return -ENXIO; | ||
414 | /* else error case */ | ||
415 | printk(MPT2SAS_ERR_FMT "handle(0x%04x), ioc_status(0x%04x), " | ||
416 | "failure at %s:%d/%s()!\n", ioc->name, handle, ioc_status, | ||
417 | __FILE__, __LINE__, __func__); | ||
418 | return -EIO; | ||
416 | } | 419 | } |
417 | 420 | ||
418 | /** | 421 | /** |