With CONFIG_BUG=n the __WARN() macro is not defined. Avoid that
building with CONFIG_BUG=n fails by replacing __WARN() with
WARN_ON(true). Also make sure that each such statement is preceeded
by an appropriate pr_err() statement.

Signed-off-by: Bart Van Assche <bvanass...@acm.org>
Cc: Nicholas Bellinger <n...@linux-iscsi.org>
Cc: Roland Dreier <rol...@purestorage.com>
Cc: Christoph Hellwig <h...@infradead.org>
Cc: Randy Dunlap <rdun...@xenotime.net>
Cc: Stephen Rothwell <s...@canb.auug.org.au>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c 
b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 48b3e19..f09d483 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1464,9 +1464,9 @@ static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch,
        } else if (opcode == SRPT_RDMA_ABORT) {
                ioctx->rdma_aborted = true;
        } else {
-               __WARN();
-               printk(KERN_ERR "%s[%d]: scmnd == NULL (opcode %d)", __func__,
-                               __LINE__, opcode);
+               pr_err("%s[%d]: unexpected opcode %d", __func__, __LINE__,
+                      opcode);
+               WARN_ON(true);
        }
 }
 
@@ -2737,7 +2737,9 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id)
                break;
        case CH_DISCONNECTING:
        case CH_DRAINING:
-               __WARN();
+               pr_err("%s[%d]: unexpected state %d\n", __func__, __LINE__,
+                      ch->state);
+               WARN_ON(true);
                break;
        }
        spin_unlock_irqrestore(&ch->spinlock, flags);
@@ -2966,7 +2968,9 @@ static int srpt_write_pending(struct se_cmd *se_cmd)
        switch (ch_state) {
        case CH_CONNECTING:
                /* This code should never be reached. */
-               __WARN();
+               pr_err("%s[%d]: unexpected state %d\n", __func__, __LINE__,
+                      ch_state);
+               WARN_ON(true);
                ret = -EINVAL;
                goto out;
        case CH_LIVE:
@@ -3030,9 +3034,9 @@ static int srpt_queue_response(struct se_cmd *cmd)
                ioctx->state = SRPT_STATE_MGMT_RSP_SENT;
                break;
        default:
-               printk(KERN_ERR "ch %p; cmd %d: unexpected command state %d\n",
+               pr_err("ch %p; cmd %d: unexpected command state %d\n",
                       ch, ioctx->ioctx.index, ioctx->state);
-               __WARN();
+               WARN_ON(true);
                break;
        }
        spin_unlock_irqrestore(&ioctx->spinlock, flags);
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to