Removes unnecessary usage of BUG_ON macro, excluding core directory.
In some cases macro is unnecesary, check is done in caller function.
In other cases macro is replaced by if construction with
appropriate warning.
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[changed some survivable bug conditions to WARN_ONCE]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_request *ireq = sci_object_get_association(sci_req);
-
SET_STATE_HANDLER(sci_req,
scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_COMPLETED);
else
isr = isci_msix_isr;
- BUG_ON(!isci_host);
-
err = devm_request_irq(&pdev->dev, msix->vector, isr, 0,
DRV_NAME"-msix", isci_host);
if (!err)
pci_disable_msix(pdev);
goto intx;
}
-
return 0;
intx:
err = devm_request_irq(&pdev->dev, pdev->irq, isci_intx_isr,
IRQF_SHARED, DRV_NAME"-intx", pdev);
-
return err;
}
unsigned long success = true;
BUG_ON(isci_phy->isci_port != NULL);
+
isci_phy->isci_port = isci_port;
dev_dbg(&isci_host->pdev->dev,
sci_object_set_association(to_sci_dev(isci_device), isci_device);
- BUG_ON(port->isci_host == NULL);
-
/* start the device. */
status = scic_remote_device_start(to_sci_dev(isci_device),
ISCI_REMOTE_DEVICE_START_TIMEOUT);
return NULL;
}
- BUG_ON(!list_empty(&idev->reqs_in_process));
- BUG_ON(!list_empty(&idev->node));
+ if (WARN_ONCE(!list_empty(&idev->reqs_in_process), "found requests in process\n"))
+ return NULL;
+
+ if (WARN_ONCE(!list_empty(&idev->node), "found non-idle remote device\n"))
+ return NULL;
+
isci_remote_device_change_state(idev, isci_freed);
return idev;
out:
if (status != SCI_SUCCESS) {
-
/* release dma memory on failure. */
isci_request_free(isci_host, request);
request = NULL;
enum isci_request_status old_state;
unsigned long flags;
- BUG_ON(isci_request == NULL);
-
spin_lock_irqsave(&isci_request->state_lock, flags);
old_state = isci_request->status;
struct isci_host *isci_host,
struct isci_request *isci_request)
{
- BUG_ON(isci_request == NULL);
+ if (!isci_request)
+ return;
/* release the dma memory if we fail. */
dma_pool_free(isci_host->dma_pool, isci_request,
{
struct scic_sds_remote_device *sci_device;
enum sci_status status = SCI_FAILURE;
- struct isci_request *request;
+ struct isci_request *request = NULL;
struct isci_remote_device *isci_device;
/* struct sci_sas_identify_address_frame_protocols dev_protocols; */
struct smp_discover_response_protocols dev_protocols;
struct isci_tmf *tmf = isci_request_access_tmf(request);
enum sci_status status;
- BUG_ON(request->ttype != tmf_task);
-
/* This task management request has timed-out. Terminate the request
* so that the request eventually completes to the requestor in the
* request completion callback path.
* request state was already set to "aborted" by the abort
* task function.
*/
- BUG_ON((old_request->status != aborted)
- && (old_request->status != completed));
+ if ((old_request->status != aborted)
+ && (old_request->status != completed))
+ dev_err(&old_request->isci_host->pdev->dev,
+ "%s: Bad request status (%d): tmf=%p, old_request=%p\n",
+ __func__, old_request->status, tmf, old_request);
break;
case isci_tmf_timed_out: