Fix Coverity defects in isci(4) driver.
Sponsored by: Intel Approved by: scottl
This commit is contained in:
parent
0ec3a99e09
commit
2d57bb86ed
@ -1124,9 +1124,6 @@ SCI_STATUS scic_sds_stp_request_pio_data_out_transmit_data(
|
|||||||
if (status == SCI_SUCCESS)
|
if (status == SCI_SUCCESS)
|
||||||
{
|
{
|
||||||
this_sds_stp_request->type.pio.pio_transfer_bytes -= remaining_bytes_in_current_sgl;
|
this_sds_stp_request->type.pio.pio_transfer_bytes -= remaining_bytes_in_current_sgl;
|
||||||
|
|
||||||
//update the current sgl, sgl_offset and save for future
|
|
||||||
current_sgl = scic_sds_stp_request_pio_get_next_sgl(this_sds_stp_request);
|
|
||||||
sgl_offset = 0;
|
sgl_offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,10 @@ SCI_STATUS scif_controller_construct(
|
|||||||
SCIF_SAS_LIBRARY_T * fw_library = (SCIF_SAS_LIBRARY_T*) library;
|
SCIF_SAS_LIBRARY_T * fw_library = (SCIF_SAS_LIBRARY_T*) library;
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
|
// Validate the user supplied parameters.
|
||||||
|
if ((library == SCI_INVALID_HANDLE) || (controller == SCI_INVALID_HANDLE))
|
||||||
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(library),
|
sci_base_object_get_logger(library),
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
||||||
@ -94,10 +98,6 @@ SCI_STATUS scif_controller_construct(
|
|||||||
library, controller
|
library, controller
|
||||||
));
|
));
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
|
||||||
if ((library == SCI_INVALID_HANDLE) || (controller == SCI_INVALID_HANDLE))
|
|
||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
|
||||||
|
|
||||||
// Construct the base controller. As part of constructing the base
|
// Construct the base controller. As part of constructing the base
|
||||||
// controller we ask it to also manage the MDL iteration for the Core.
|
// controller we ask it to also manage the MDL iteration for the Core.
|
||||||
sci_base_controller_construct(
|
sci_base_controller_construct(
|
||||||
@ -144,6 +144,10 @@ SCI_STATUS scif_controller_initialize(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
|
// Validate the user supplied parameters.
|
||||||
|
if (controller == SCI_INVALID_HANDLE)
|
||||||
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(controller),
|
sci_base_object_get_logger(controller),
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
||||||
@ -151,10 +155,6 @@ SCI_STATUS scif_controller_initialize(
|
|||||||
controller
|
controller
|
||||||
));
|
));
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
|
||||||
if (controller == SCI_INVALID_HANDLE)
|
|
||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
|
||||||
|
|
||||||
return fw_controller->state_handlers->initialize_handler(
|
return fw_controller->state_handlers->initialize_handler(
|
||||||
&fw_controller->parent
|
&fw_controller->parent
|
||||||
);
|
);
|
||||||
@ -187,6 +187,10 @@ SCI_STATUS scif_controller_start(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
|
// Validate the user supplied parameters.
|
||||||
|
if (controller == SCI_INVALID_HANDLE)
|
||||||
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(controller),
|
sci_base_object_get_logger(controller),
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
|
||||||
@ -194,10 +198,6 @@ SCI_STATUS scif_controller_start(
|
|||||||
controller, timeout
|
controller, timeout
|
||||||
));
|
));
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
|
||||||
if (controller == SCI_INVALID_HANDLE)
|
|
||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
|
||||||
|
|
||||||
return fw_controller->state_handlers->
|
return fw_controller->state_handlers->
|
||||||
start_handler(&fw_controller->parent, timeout);
|
start_handler(&fw_controller->parent, timeout);
|
||||||
}
|
}
|
||||||
@ -211,6 +211,10 @@ SCI_STATUS scif_controller_stop(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
|
// Validate the user supplied parameters.
|
||||||
|
if (controller == SCI_INVALID_HANDLE)
|
||||||
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(controller),
|
sci_base_object_get_logger(controller),
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_SHUTDOWN,
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_SHUTDOWN,
|
||||||
@ -218,10 +222,6 @@ SCI_STATUS scif_controller_stop(
|
|||||||
controller, timeout
|
controller, timeout
|
||||||
));
|
));
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
|
||||||
if (controller == SCI_INVALID_HANDLE)
|
|
||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
|
||||||
|
|
||||||
return fw_controller->state_handlers->
|
return fw_controller->state_handlers->
|
||||||
stop_handler(&fw_controller->parent, timeout);
|
stop_handler(&fw_controller->parent, timeout);
|
||||||
|
|
||||||
@ -235,6 +235,10 @@ SCI_STATUS scif_controller_reset(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
|
// Validate the user supplied parameters.
|
||||||
|
if (controller == SCI_INVALID_HANDLE)
|
||||||
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(controller),
|
sci_base_object_get_logger(controller),
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_CONTROLLER_RESET,
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_CONTROLLER_RESET,
|
||||||
@ -242,10 +246,6 @@ SCI_STATUS scif_controller_reset(
|
|||||||
controller
|
controller
|
||||||
));
|
));
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
|
||||||
if (controller == SCI_INVALID_HANDLE)
|
|
||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
|
||||||
|
|
||||||
return fw_controller->state_handlers->
|
return fw_controller->state_handlers->
|
||||||
reset_handler(&fw_controller->parent);
|
reset_handler(&fw_controller->parent);
|
||||||
}
|
}
|
||||||
@ -306,13 +306,6 @@ SCI_TASK_STATUS scif_controller_start_task(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
|
||||||
sci_base_object_get_logger(controller),
|
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
|
|
||||||
"scif_controller_start_task(0x%x, 0x%x, 0x%x, 0x%x) enter\n",
|
|
||||||
controller, remote_device, task_request, io_tag
|
|
||||||
));
|
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
// Validate the user supplied parameters.
|
||||||
if ( (controller == SCI_INVALID_HANDLE)
|
if ( (controller == SCI_INVALID_HANDLE)
|
||||||
|| (remote_device == SCI_INVALID_HANDLE)
|
|| (remote_device == SCI_INVALID_HANDLE)
|
||||||
@ -321,6 +314,13 @@ SCI_TASK_STATUS scif_controller_start_task(
|
|||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCIF_LOG_TRACE((
|
||||||
|
sci_base_object_get_logger(controller),
|
||||||
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
|
||||||
|
"scif_controller_start_task(0x%x, 0x%x, 0x%x, 0x%x) enter\n",
|
||||||
|
controller, remote_device, task_request, io_tag
|
||||||
|
));
|
||||||
|
|
||||||
if (scif_sas_controller_sufficient_resource(controller))
|
if (scif_sas_controller_sufficient_resource(controller))
|
||||||
{
|
{
|
||||||
return fw_controller->state_handlers->start_task_handler(
|
return fw_controller->state_handlers->start_task_handler(
|
||||||
@ -368,13 +368,6 @@ SCI_STATUS scif_controller_complete_task(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller;
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
|
||||||
sci_base_object_get_logger(controller),
|
|
||||||
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
|
|
||||||
"scif_controller_complete_task(0x%x, 0x%x, 0x%x) enter\n",
|
|
||||||
controller, remote_device, task_request
|
|
||||||
));
|
|
||||||
|
|
||||||
// Validate the user supplied parameters.
|
// Validate the user supplied parameters.
|
||||||
if ( (controller == SCI_INVALID_HANDLE)
|
if ( (controller == SCI_INVALID_HANDLE)
|
||||||
|| (remote_device == SCI_INVALID_HANDLE)
|
|| (remote_device == SCI_INVALID_HANDLE)
|
||||||
@ -383,6 +376,13 @@ SCI_STATUS scif_controller_complete_task(
|
|||||||
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCIF_LOG_TRACE((
|
||||||
|
sci_base_object_get_logger(controller),
|
||||||
|
SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
|
||||||
|
"scif_controller_complete_task(0x%x, 0x%x, 0x%x) enter\n",
|
||||||
|
controller, remote_device, task_request
|
||||||
|
));
|
||||||
|
|
||||||
return fw_controller->state_handlers->complete_task_handler(
|
return fw_controller->state_handlers->complete_task_handler(
|
||||||
(SCI_BASE_CONTROLLER_T*) controller,
|
(SCI_BASE_CONTROLLER_T*) controller,
|
||||||
(SCI_BASE_REMOTE_DEVICE_T*) remote_device,
|
(SCI_BASE_REMOTE_DEVICE_T*) remote_device,
|
||||||
|
@ -142,8 +142,8 @@ SCI_PORT_HANDLE_T scif_domain_get_scic_port_handle(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_DOMAIN_T * fw_domain = (SCIF_SAS_DOMAIN_T*) domain;
|
SCIF_SAS_DOMAIN_T * fw_domain = (SCIF_SAS_DOMAIN_T*) domain;
|
||||||
|
|
||||||
if ( (fw_domain != NULL) && (fw_domain->core_object != SCI_INVALID_HANDLE) )
|
if ( (fw_domain == NULL) || (fw_domain->core_object == SCI_INVALID_HANDLE) )
|
||||||
return fw_domain->core_object;
|
return SCI_INVALID_HANDLE;
|
||||||
|
|
||||||
SCIF_LOG_WARNING((
|
SCIF_LOG_WARNING((
|
||||||
sci_base_object_get_logger(fw_domain),
|
sci_base_object_get_logger(fw_domain),
|
||||||
@ -152,7 +152,7 @@ SCI_PORT_HANDLE_T scif_domain_get_scic_port_handle(
|
|||||||
fw_domain
|
fw_domain
|
||||||
));
|
));
|
||||||
|
|
||||||
return SCI_INVALID_HANDLE;
|
return fw_domain->core_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -362,8 +362,8 @@ SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device_get_scic_handle(
|
|||||||
SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T*)
|
SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T*)
|
||||||
scif_remote_device;
|
scif_remote_device;
|
||||||
|
|
||||||
if ( (fw_device != NULL) && (fw_device->core_object != SCI_INVALID_HANDLE) )
|
if ( (fw_device == NULL) || (fw_device->core_object == SCI_INVALID_HANDLE) )
|
||||||
return fw_device->core_object;
|
return SCI_INVALID_HANDLE;
|
||||||
|
|
||||||
SCIF_LOG_WARNING((
|
SCIF_LOG_WARNING((
|
||||||
sci_base_object_get_logger(fw_device),
|
sci_base_object_get_logger(fw_device),
|
||||||
@ -372,7 +372,7 @@ SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device_get_scic_handle(
|
|||||||
fw_device
|
fw_device
|
||||||
));
|
));
|
||||||
|
|
||||||
return SCI_INVALID_HANDLE;
|
return fw_device->core_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -580,7 +580,7 @@ SCI_STATUS scif_sas_smp_external_request_retry(
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
//unsupported case, TBD
|
//unsupported case, TBD
|
||||||
break;
|
return SCI_FAILURE;
|
||||||
} //end of switch
|
} //end of switch
|
||||||
|
|
||||||
//set the retry count to new built smp request.
|
//set the retry count to new built smp request.
|
||||||
|
@ -748,7 +748,6 @@ SCI_STATUS scif_sas_smp_remote_device_decode_target_reset_discover_response(
|
|||||||
{
|
{
|
||||||
SCIF_SAS_DOMAIN_T * fw_domain;
|
SCIF_SAS_DOMAIN_T * fw_domain;
|
||||||
SCI_SAS_ADDRESS_T attached_device_address;
|
SCI_SAS_ADDRESS_T attached_device_address;
|
||||||
SCIF_SAS_REMOTE_DEVICE_T * attached_remote_device;
|
|
||||||
SMP_RESPONSE_DISCOVER_T * discover_response =
|
SMP_RESPONSE_DISCOVER_T * discover_response =
|
||||||
&smp_response->response.discover;
|
&smp_response->response.discover;
|
||||||
|
|
||||||
@ -782,13 +781,11 @@ SCI_STATUS scif_sas_smp_remote_device_decode_target_reset_discover_response(
|
|||||||
fw_domain = fw_device->domain;
|
fw_domain = fw_device->domain;
|
||||||
attached_device_address = discover_response->attached_sas_address;
|
attached_device_address = discover_response->attached_sas_address;
|
||||||
|
|
||||||
attached_remote_device = (SCIF_SAS_REMOTE_DEVICE_T *)
|
|
||||||
scif_domain_get_device_by_sas_address(
|
|
||||||
fw_domain, &attached_device_address
|
|
||||||
);
|
|
||||||
|
|
||||||
// the device should have already existed in the domian.
|
// the device should have already existed in the domian.
|
||||||
ASSERT (attached_remote_device != SCI_INVALID_HANDLE);
|
ASSERT(scif_domain_get_device_by_sas_address(
|
||||||
|
fw_domain,
|
||||||
|
&attached_device_address
|
||||||
|
) != SCI_INVALID_HANDLE);
|
||||||
return SCI_SUCCESS;
|
return SCI_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1774,6 +1771,8 @@ SCIF_SAS_SMP_PHY_T * scif_sas_smp_remote_device_find_smp_phy_by_id(
|
|||||||
SCI_FAST_LIST_ELEMENT_T * element = smp_remote_device->smp_phy_list.list_head;
|
SCI_FAST_LIST_ELEMENT_T * element = smp_remote_device->smp_phy_list.list_head;
|
||||||
SCIF_SAS_SMP_PHY_T * curr_smp_phy = NULL;
|
SCIF_SAS_SMP_PHY_T * curr_smp_phy = NULL;
|
||||||
|
|
||||||
|
ASSERT(phy_identifier < smp_remote_device->smp_phy_list.number_of_phys);
|
||||||
|
|
||||||
while (element != NULL)
|
while (element != NULL)
|
||||||
{
|
{
|
||||||
curr_smp_phy = (SCIF_SAS_SMP_PHY_T*) sci_fast_list_get_object(element);
|
curr_smp_phy = (SCIF_SAS_SMP_PHY_T*) sci_fast_list_get_object(element);
|
||||||
@ -1934,11 +1933,8 @@ SCI_STATUS scif_sas_smp_remote_device_save_smp_phy_info(
|
|||||||
scif_domain_get_device_by_sas_address(
|
scif_domain_get_device_by_sas_address(
|
||||||
fw_device->domain, &discover_response->attached_sas_address);
|
fw_device->domain, &discover_response->attached_sas_address);
|
||||||
|
|
||||||
if (smp_phy != NULL)
|
scif_sas_smp_phy_save_information(
|
||||||
{
|
smp_phy, attached_device, discover_response);
|
||||||
scif_sas_smp_phy_save_information(
|
|
||||||
smp_phy, attached_device, discover_response);
|
|
||||||
}
|
|
||||||
|
|
||||||
//handle the special case of smp phys between expanders.
|
//handle the special case of smp phys between expanders.
|
||||||
if ( discover_response->protocols.u.bits.attached_smp_target )
|
if ( discover_response->protocols.u.bits.attached_smp_target )
|
||||||
@ -2372,11 +2368,7 @@ void scif_sas_smp_remote_device_clean_route_table(
|
|||||||
SCIF_SAS_REMOTE_DEVICE_T * fw_device
|
SCIF_SAS_REMOTE_DEVICE_T * fw_device
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SCIF_SAS_SMP_PHY_T * smp_phy_being_config =
|
SCIF_SAS_SMP_PHY_T * smp_phy_being_config;
|
||||||
scif_sas_smp_remote_device_find_smp_phy_by_id(
|
|
||||||
fw_device->protocol_device.smp_device.current_activity_phy_index,
|
|
||||||
&(fw_device->protocol_device.smp_device)
|
|
||||||
);
|
|
||||||
|
|
||||||
SCIF_LOG_TRACE((
|
SCIF_LOG_TRACE((
|
||||||
sci_base_object_get_logger(fw_device),
|
sci_base_object_get_logger(fw_device),
|
||||||
|
Loading…
Reference in New Issue
Block a user