mlx5: minor fixes (mainly avoidance of hidden casts)
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Mon, 28 Jul 2014 20:30:23 +0000 (23:30 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Jul 2014 21:00:06 +0000 (14:00 -0700)
There were many places where parameters which should be u8/u16 were
integer type.

Additionally, in 2 places, a check for a non-null pointer was added
before dereferencing the pointer (this is actually a bug fix).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 files changed:
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/mad.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mem.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/qp.c
drivers/net/ethernet/mellanox/mlx5/core/alloc.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/eq.c
drivers/net/ethernet/mellanox/mlx5/core/mad.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
drivers/net/ethernet/mellanox/mlx5/core/port.c
include/linux/mlx5/device.h
include/linux/mlx5/driver.h

index 3b4dc858cef9fc2d4ab132c868e80b552fa70dd0..e4056279166d3b4775aabfc10e4f786128a68d95 100644 (file)
@@ -348,7 +348,7 @@ static void handle_atomic(struct mlx5_ib_qp *qp, struct mlx5_cqe64 *cqe64,
 static void handle_atomics(struct mlx5_ib_qp *qp, struct mlx5_cqe64 *cqe64,
                           u16 tail, u16 head)
 {
-       int idx;
+       u16 idx;
 
        do {
                idx = tail & (qp->sq.wqe_cnt - 1);
index e259e7393152705abc42f269906117cf6f882e6e..b514bbb5610ffea4643fedf708d61ddf695b5f0e 100644 (file)
@@ -41,7 +41,7 @@ enum {
 };
 
 int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey,
-                int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
+                u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh,
                 void *in_mad, void *response_mad)
 {
        u8 op_modifier = 0;
index f2cfd363a705e93ecf66c42e68222d7fd62ca3e9..166335a95c5996c7cca306c13127c7de96c78fcf 100644 (file)
@@ -478,7 +478,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
        int uuarn;
        int err;
        int i;
-       int reqlen;
+       size_t reqlen;
 
        if (!dev->ib_active)
                return ERR_PTR(-EAGAIN);
index 8499aec94db6a495f64de4540e26f753b1dfa032..a3e81444c82519b6e3b7305ac6cb5911a69b20ce 100644 (file)
@@ -148,7 +148,7 @@ int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset)
        u64 off_mask;
        u64 buf_off;
 
-       page_size = 1 << page_shift;
+       page_size = (u64)1 << page_shift;
        page_mask = page_size - 1;
        buf_off = addr & page_mask;
        off_size = page_size >> 6;
index a0e204ffe367142058c44bf20fe7c302eccdcaba..386780f0d1e18304927d8a3c42705c4be916b731 100644 (file)
@@ -461,7 +461,7 @@ void __mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq)
 void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq);
 void mlx5_ib_free_srq_wqe(struct mlx5_ib_srq *srq, int wqe_index);
 int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey,
-                int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
+                u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh,
                 void *in_mad, void *response_mad);
 struct ib_ah *create_ib_ah(struct ib_ah_attr *ah_attr,
                           struct mlx5_ib_ah *ah);
index b8bb6ad6350cbd3d3a382813ccf7ecc82a5a3847..7efe6e3f3542f39b79a69fdb4f5ffb55c6c93ea1 100644 (file)
@@ -2539,7 +2539,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                        case IB_WR_RDMA_WRITE_WITH_IMM:
                                set_raddr_seg(seg, wr->wr.rdma.remote_addr,
                                              wr->wr.rdma.rkey);
-                               seg  += sizeof(struct mlx5_wqe_raddr_seg);
+                               seg += sizeof(struct mlx5_wqe_raddr_seg);
                                size += sizeof(struct mlx5_wqe_raddr_seg) / 16;
                                break;
 
@@ -2668,7 +2668,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                case IB_QPT_SMI:
                case IB_QPT_GSI:
                        set_datagram_seg(seg, wr);
-                       seg  += sizeof(struct mlx5_wqe_datagram_seg);
+                       seg += sizeof(struct mlx5_wqe_datagram_seg);
                        size += sizeof(struct mlx5_wqe_datagram_seg) / 16;
                        if (unlikely((seg == qend)))
                                seg = mlx5_get_send_wqe(qp, 0);
index b215742b842fb4e31092107a318851dd706f553a..56779c1c78113c72312beff9b4d655a8f281cf9c 100644 (file)
@@ -56,7 +56,7 @@ int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
        if (size <= max_direct) {
                buf->nbufs        = 1;
                buf->npages       = 1;
-               buf->page_shift   = get_order(size) + PAGE_SHIFT;
+               buf->page_shift   = (u8)get_order(size) + PAGE_SHIFT;
                buf->direct.buf   = dma_zalloc_coherent(&dev->pdev->dev,
                                                        size, &t, GFP_KERNEL);
                if (!buf->direct.buf)
index 87d1b018a9c394309a6ee78310640690146bf245..4671747dd3651a73c8a4f7833a61c453027de6bf 100644 (file)
@@ -464,7 +464,7 @@ static void dump_command(struct mlx5_core_dev *dev,
        struct mlx5_cmd_msg *msg = input ? ent->in : ent->out;
        struct mlx5_cmd_mailbox *next = msg->next;
        int data_only;
-       int offset = 0;
+       u32 offset = 0;
        int dump_len;
 
        data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA));
index 7f39ebcd6ad01b3dc175ffd57b3239f9f7154a8a..67cead2c079e9339d72e9f7ddd096c554907565a 100644 (file)
@@ -252,7 +252,8 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
                        case MLX5_PORT_CHANGE_SUBTYPE_GUID:
                        case MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG:
                        case MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED:
-                               dev->event(dev, port_subtype_event(eqe->sub_type), &port);
+                               if (dev->event)
+                                       dev->event(dev, port_subtype_event(eqe->sub_type), &port);
                                break;
                        default:
                                mlx5_core_warn(dev, "Port event with unrecognized subtype: port %d, sub_type %d\n",
index 18d6fd5dd90b2cca119d99d8f6f02b687579cfdf..fd80ecfa7195195464b8ccd2f0cfc1bc556d96c2 100644 (file)
@@ -37,7 +37,7 @@
 #include "mlx5_core.h"
 
 int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
-                     u16 opmod, int port)
+                     u16 opmod, u8 port)
 {
        struct mlx5_mad_ifc_mbox_in *in = NULL;
        struct mlx5_mad_ifc_mbox_out *out = NULL;
index 4b7f9da4bf113237fd5529894274e25b8719ab0a..fd782bf49dc64c8846e30bf3a4f5e7851f868d2c 100644 (file)
@@ -311,7 +311,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
 
        copy_rw_fields(&set_ctx->hca_cap, &query_out->hca_cap);
 
-       if (dev->profile->mask & MLX5_PROF_MASK_QP_SIZE)
+       if (dev->profile && dev->profile->mask & MLX5_PROF_MASK_QP_SIZE)
                set_ctx->hca_cap.log_max_qp = dev->profile->log_max_qp;
 
        flags = be64_to_cpu(query_out->hca_cap.flags);
index c2a953ef0e675801827ac9bec57e1aaf399dbcca..d476918ef269662eb1d77da8d81b99deb3d7617c 100644 (file)
@@ -51,7 +51,7 @@ enum {
 
 struct mlx5_pages_req {
        struct mlx5_core_dev *dev;
-       u32     func_id;
+       u16     func_id;
        s32     npages;
        struct work_struct work;
 };
index 8c9ac870ecb170001be01a6e1cb433a0487ea827..313965853e10c14a603e71f6207b267c63aafb45 100644 (file)
@@ -86,7 +86,7 @@ struct mlx5_reg_pcap {
        __be32                  caps_31_0;
 };
 
-int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps)
+int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps)
 {
        struct mlx5_reg_pcap in;
        struct mlx5_reg_pcap out;
index 3406cfb1267a9bbf5bd9cb2294309535e5d74eee..334947151dfc4651385ef6dd4ad21bbf0e42259a 100644 (file)
@@ -456,9 +456,6 @@ struct mlx5_eqe_cq_err {
        u8      syndrome;
 };
 
-struct mlx5_eqe_dropped_packet {
-};
-
 struct mlx5_eqe_port_state {
        u8      reserved0[8];
        u8      port;
@@ -498,7 +495,6 @@ union ev_data {
        struct mlx5_eqe_comp            comp;
        struct mlx5_eqe_qp_srq          qp_srq;
        struct mlx5_eqe_cq_err          cq_err;
-       struct mlx5_eqe_dropped_packet  dp;
        struct mlx5_eqe_port_state      port;
        struct mlx5_eqe_gpio            gpio;
        struct mlx5_eqe_congestion      cong;
index d0cb5984a45f836f020b0f184c043b218b347dcf..76de0cc41640ad6e51a8eb9879e56eec41e58f0f 100644 (file)
@@ -381,8 +381,8 @@ struct mlx5_buf {
        struct mlx5_buf_list   *page_list;
        int                     nbufs;
        int                     npages;
-       int                     page_shift;
        int                     size;
+       u8                      page_shift;
 };
 
 struct mlx5_eq {
@@ -736,7 +736,7 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
 int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
 int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
 int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
-                     u16 opmod, int port);
+                     u16 opmod, u8 port);
 void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
 void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
 int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
@@ -769,7 +769,7 @@ void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
 int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
                         int size_in, void *data_out, int size_out,
                         u16 reg_num, int arg, int write);
-int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps);
+int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
 
 int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
 void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
@@ -826,7 +826,7 @@ void mlx5_unregister_interface(struct mlx5_interface *intf);
 
 struct mlx5_profile {
        u64     mask;
-       u32     log_max_qp;
+       u     log_max_qp;
        struct {
                int     size;
                int     limit;