RDMA/nes: Use WARN()
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 3 Nov 2012 10:58:37 +0000 (10:58 +0000)
committerRoland Dreier <roland@purestorage.com>
Thu, 22 Nov 2012 08:49:15 +0000 (00:49 -0800)
Use WARN() rather than printk() followed by WARN_ON(1), for conciseness.

A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression list es;
@@

-printk(
+WARN(1,
  es);
-WARN_ON(1);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
[ Remove extra KERN_ERR from WARN() format.  - Roland ]

Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/nes/nes_cm.c
drivers/infiniband/hw/nes/nes_mgt.c

index cfaacaf6bf5f9c8e11ce0bb5c0dce62c54e15ae4..feb41e74206b232fb0addf62b08db5207f12a9a3 100644 (file)
@@ -629,11 +629,9 @@ static void build_rdma0_msg(struct nes_cm_node *cm_node, struct nes_qp **nesqp_a
 
        case SEND_RDMA_READ_ZERO:
        default:
-               if (cm_node->send_rdma0_op != SEND_RDMA_READ_ZERO) {
-                       printk(KERN_ERR "%s[%u]: Unsupported RDMA0 len operation=%u\n",
-                                __func__, __LINE__, cm_node->send_rdma0_op);
-                       WARN_ON(1);
-               }
+               if (cm_node->send_rdma0_op != SEND_RDMA_READ_ZERO)
+                       WARN(1, "Unsupported RDMA0 len operation=%u\n",
+                            cm_node->send_rdma0_op);
                nes_debug(NES_DBG_CM, "Sending first rdma operation.\n");
                wqe->wqe_words[NES_IWARP_SQ_WQE_MISC_IDX] =
                        cpu_to_le32(NES_IWARP_SQ_OP_RDMAR);
index 4d6d77fd18b6b51e6ec87c8554e2258a818a8799..416645259b0f84b6a444596e7c8acc85189d6c84 100644 (file)
@@ -649,11 +649,9 @@ static void nes_chg_qh_handler(struct nes_device *nesdev, struct nes_cqp_request
        nesqp = qh_chg->nesqp;
 
        /* Should we handle the bad completion */
-       if (cqp_request->major_code) {
-               printk(KERN_ERR PFX "Invalid cqp_request major_code=0x%x\n",
+       if (cqp_request->major_code)
+               WARN(1, PFX "Invalid cqp_request major_code=0x%x\n",
                       cqp_request->major_code);
-               WARN_ON(1);
-       }
 
        switch (nesqp->pau_state) {
        case PAU_DEL_QH: