From patchwork Sat Feb 18 20:58:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9581249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 67F5C604A4 for ; Sat, 18 Feb 2017 20:59:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D14E28739 for ; Sat, 18 Feb 2017 20:59:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E0F028768; Sat, 18 Feb 2017 20:59:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABBAB28739 for ; Sat, 18 Feb 2017 20:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753745AbdBRU7p (ORCPT ); Sat, 18 Feb 2017 15:59:45 -0500 Received: from mout.web.de ([212.227.15.3]:51997 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753277AbdBRU7o (ORCPT ); Sat, 18 Feb 2017 15:59:44 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0McWbQ-1cwrV02pZA-00Hd3S; Sat, 18 Feb 2017 21:58:47 +0100 Subject: [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Leon Romanovsky , Matan Barak , Sean Hefty , Yishai Hadas References: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Sat, 18 Feb 2017 21:58:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> X-Provags-ID: V03:K0:NZ/VPTw9fF9ZStg1Kh4e9HL0Nq2ikTcrrvXE9MAytQu2HL1/03S vlJQWYOjru/YQ5rSs83UFKZncV5vU1UNETl3yXzHilFt1c95m/+QLaz0ZdmoyM4KR9CKTVa bnZI43GVWIuIoGMDBEEEf0BHSkm2yXpbIA8ExCT00sR6RC5pGjblP2k6PCWh6N72rDNqOMR JC4CrIrz9SQ9TCrd4ZNvQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:wo6p3S1VdBU=:1KHt3ofW2s2ttyKfwNnJ5Z Y1wyaj56OrTm+7/AmxgfIJ9DNFl2334VT1ZT0G0a8JyPQX5S1j9xlu62YtC0K4GiT5KOVLnZE DECWArc9npjJKmj+6rmuqVBzf1+RDb2APm6gtI55b/Pj6JJIxaQyQOtGRlhoZm04iZZcNA8Cl pH0yP9uj33PUYjPd9PwxhjH3P82MZpZHnrKQ4PybYgYNLhR5LBuD7KSNqvN0q+MdczFce3D1P +54O6FFu+bVX9lAJ46/0C72EXujvtFv9VqczwGveZvXK7Q0um/nQYPuKSPZE00aBaXpA7QFWo V4T16FyEz9hcABcXVjsNzHV2p5rSiQsic7uAsUPHIdaB6XCwiQtfiFnsMaJIXM0HzAAL/ZBVH P2pPuXj7gQZMe3ooTSGFx8ig7Fh9MMB2OQrdlcEPXleH1/uKrqQ7FlbIbwKpCcojcyhusdos8 yXHJfZKtsGrsc5cehpjdyTC8Zk71p9v4By1raVUOvqiNs1L6vf8toP2dX98+jXU1VJveybHwx x1HrQwvMV1paUxh0fPm3UzdO6j6xr8AeXoqHdL9C14/05DAPkbCA27QfG6p/U8OWK8jHkkj92 WP96WBXf27pvyw5lbEct8b5ipnnuRWNRGRt57Q1o3SXurcv+3GKvMqZDazI/dnUFz772Yt7AD 9e7Kz3tZDhraaDWL01xrKZxXJEJ/cZy9SP6Mxrw9PCubEMgNGK5KtQAOu6kCjoGC27JfZ7opP cWCiNKDF3yUUHV97W5sZp1d2rqx/h//qKYtXa+liNv9kkc3woYR6HbQ2wP8DU0gMlm2COHCqY c0315Y4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 18 Feb 2017 09:54:15 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script "checkpatch.pl" pointed information out like the following. WARNING: sizeof … should be sizeof(…) Thus fix the affected source code places. Signed-off-by: Markus Elfring Reviewed-by: Majd Dibbiny --- drivers/infiniband/hw/mlx4/mad.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 860fec8b9601..b26817f0669f 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -195,7 +195,7 @@ static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl) if (!dev->send_agent[port_num - 1][0]) return; - memset(&ah_attr, 0, sizeof ah_attr); + memset(&ah_attr, 0, sizeof(ah_attr)); ah_attr.dlid = lid; ah_attr.sl = sl; ah_attr.port_num = port_num; @@ -400,7 +400,7 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m * it's OK for our devices). */ spin_lock_irqsave(&dev->sm_lock, flags); - memcpy(send_buf->mad, mad, sizeof *mad); + memcpy(send_buf->mad, mad, sizeof(*mad)); send_buf->ah = dev->sm_ah[port_num - 1]; if (send_buf->ah) ret = ib_post_send_mad(send_buf, NULL); @@ -555,7 +555,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, /* create ah. Just need an empty one with the port num for the post send. * The driver will set the force loopback bit in post_send */ - memset(&attr, 0, sizeof attr); + memset(&attr, 0, sizeof(attr)); attr.port_num = port; if (is_eth) { union ib_gid sgid; @@ -590,8 +590,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, /* copy over to tunnel buffer */ if (grh) - memcpy(&tun_mad->grh, grh, sizeof *grh); - memcpy(&tun_mad->mad, mad, sizeof *mad); + memcpy(&tun_mad->grh, grh, sizeof(*grh)); + memcpy(&tun_mad->mad, mad, sizeof(*mad)); /* adjust tunnel data */ tun_mad->hdr.pkey_index = cpu_to_be16(tun_pkey_ix); @@ -961,7 +961,7 @@ static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, } mutex_unlock(&dev->counters_table[port_num - 1].mutex); if (stats_avail) { - memset(out_mad->data, 0, sizeof out_mad->data); + memset(out_mad->data, 0, sizeof(out_mad->data)); switch (counter_stats.counter_mode & 0xf) { case 0: edit_counter(&counter_stats, @@ -1136,11 +1136,11 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num, if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev)) return; - in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); + in_mad = kmalloc(sizeof(*in_mad), GFP_KERNEL); if (!in_mad) return; - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!out_mad) goto free_in_mad; @@ -1149,8 +1149,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num, for (i = 0; i < 4; i++) { if (change_bitmap && (!((change_bitmap >> (8 * i)) & 0xff))) continue; - memset(in_mad, 0, sizeof *in_mad); - memset(out_mad, 0, sizeof *out_mad); + memset(in_mad, 0, sizeof(*in_mad)); + memset(out_mad, 0, sizeof(*out_mad)); in_mad->base_version = 1; in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; @@ -1421,7 +1421,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, sizeof (struct mlx4_mad_snd_buf), DMA_TO_DEVICE); - memcpy(&sqp_mad->payload, mad, sizeof *mad); + memcpy(&sqp_mad->payload, mad, sizeof(*mad)); ib_dma_sync_single_for_device(&dev->ib_dev, sqp->tx_ring[wire_tx_ix].buf.map, @@ -1804,7 +1804,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, tun_qp = &ctx->qp[qp_type]; - memset(&qp_init_attr, 0, sizeof qp_init_attr); + memset(&qp_init_attr, 0, sizeof(qp_init_attr)); qp_init_attr.init_attr.send_cq = ctx->cq; qp_init_attr.init_attr.recv_cq = ctx->cq; qp_init_attr.init_attr.sq_sig_type = IB_SIGNAL_ALL_WR; @@ -1837,7 +1837,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, return ret; } - memset(&attr, 0, sizeof attr); + memset(&attr, 0, sizeof(attr)); attr.qp_state = IB_QPS_INIT; ret = 0; if (create_tun) @@ -2184,7 +2184,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, goto err_mcg; } - snprintf(name, sizeof name, "mlx4_ibt%d", port); + snprintf(name, sizeof(name), "mlx4_ibt%d", port); ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!ctx->wq) { pr_err("Failed to create tunnelling WQ for port %d\n", port); @@ -2192,7 +2192,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, goto err_wq; } - snprintf(name, sizeof name, "mlx4_ibud%d", port); + snprintf(name, sizeof(name), "mlx4_ibud%d", port); ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!ctx->ud_wq) { pr_err("Failed to create up/down WQ for port %d\n", port);