unsigned int nents = 0;
 
        while (nbytes != 0) {
-               if (sg_is_chain(sg_list)) {
-                       SSI_LOG_ERR("Unexpected chained entry "
-                                  "in sg (entry =0x%X)\n", nents);
-                       BUG();
-               }
                if (sg_list->length != 0) {
                        nents++;
                        /* get the number of bytes in the last entry */
                        //if have reached the end of the sgl, then this is unexpected
                        if (!current_sg) {
                                SSI_LOG_ERR("reached end of sg list. unexpected\n");
-                               BUG();
+                               return -EINVAL;
                        }
                        sg_index += current_sg->length;
                        mapped_nents++;
 
        offset = size_to_skip;
 
-       if (!sg_data) {
-               rc = -EINVAL;
-               goto chain_data_exit;
-       }
+       if (!sg_data)
+               return -EINVAL;
+
        areq_ctx->src_sgl = req->src;
        areq_ctx->dst_sgl = req->dst;
 
                //if have reached the end of the sgl, then this is unexpected
                if (!areq_ctx->src_sgl) {
                        SSI_LOG_ERR("reached end of sg list. unexpected\n");
-                       BUG();
+                       return -EINVAL;
                }
                sg_index += areq_ctx->src_sgl->length;
                src_mapped_nents--;
                //if have reached the end of the sgl, then this is unexpected
                if (!areq_ctx->dst_sgl) {
                        SSI_LOG_ERR("reached end of sg list. unexpected\n");
-                       BUG();
+                       return -EINVAL;
                }
                sg_index += areq_ctx->dst_sgl->length;
                dst_mapped_nents--;
 
                break;
        default:
                SSI_LOG_ERR("Unsupported cipher mode (%d)\n", cipher_mode);
-               BUG();
        }
 }
 
 
                rc = pm_runtime_put_autosuspend(dev);
        } else {
                /* Something wrong happens*/
-               BUG();
+               SSI_LOG_ERR("request to suspend already suspended queue");
+               rc = -EBUSY;
        }
        return rc;
 }
 
        enqueue_seq(cc_base, &req_mgr_h->compl_desc, (is_dout ? 0 : 1));
 
        if (unlikely(req_mgr_h->q_free_slots < total_seq_len)) {
-               /*This means that there was a problem with the resume*/
-               BUG();
+               /* This situation should never occur. Maybe indicating problem
+                * with resuming power. Set the free slot count to 0 and hope
+                * for the best.
+                */
+               SSI_LOG_ERR("HW free slot count mismatch.");
+               req_mgr_h->q_free_slots = 0;
+       } else {
+               /* Update the free slots in HW queue */
+               req_mgr_h->q_free_slots -= total_seq_len;
        }
-       /* Update the free slots in HW queue */
-       req_mgr_h->q_free_slots -= total_seq_len;
 
        spin_unlock_bh(&req_mgr_h->hw_lock);
 
 
                /* Dequeue request */
                if (unlikely(request_mgr_handle->req_queue_head == request_mgr_handle->req_queue_tail)) {
-                       SSI_LOG_ERR("Request queue is empty req_queue_head==req_queue_tail==%u\n", request_mgr_handle->req_queue_head);
-                       BUG();
+                       /* We are supposed to handle a completion but our
+                        * queue is empty. This is not normal. Return and
+                        * hope for the best.
+                        */
+                       SSI_LOG_ERR("Request queue is empty head == tail %u\n",
+                                   request_mgr_handle->req_queue_head);
+                       break;
                }
 
                ssi_req = &request_mgr_handle->req_queue[request_mgr_handle->req_queue_tail];