From patchwork Sat Feb 18 21:00:45 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: 9581255 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 3D348604A4 for ; Sat, 18 Feb 2017 21:01:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B39128578 for ; Sat, 18 Feb 2017 21:01:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DF8928706; Sat, 18 Feb 2017 21:01:58 +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=unavailable 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 90D8128578 for ; Sat, 18 Feb 2017 21:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525AbdBRVBo (ORCPT ); Sat, 18 Feb 2017 16:01:44 -0500 Received: from mout.web.de ([212.227.15.14]:63968 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753357AbdBRVBn (ORCPT ); Sat, 18 Feb 2017 16:01:43 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MQNjQ-1cmvrP0Gk8-00TjbS; Sat, 18 Feb 2017 22:00:47 +0100 Subject: [PATCH 12/29] IB/mlx4: Enclose 17 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: <9ba34d2d-1d54-4f65-4c01-152c72b624b4@users.sourceforge.net> Date: Sat, 18 Feb 2017 22:00:45 +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:KUKejp1O3hg3eLyWsFFTQ/M/drhcPFei5Ko/T0cS0XI5Tedk/V2 WZ7sl7fSH7eD3nN99BvGWEyKe2u0VB+qJwPWzs+pmbZGAK0goILKe1T8ttukRv8+HIxBT5o 9W7Si8bV/uojSHMxSvDE6AZQ+XTcHMNF91L7fliMpnrcR2cJoXqQ/CvCoh17vLqgLsQLm/S UxpzZhq6M/VUNIxobv+WA== X-UI-Out-Filterresults: notjunk:1; V01:K0:bxjz0aLJCbM=:HZ+Me9KIvl240w5MOA5Cd6 /cLhV6wfB3V0/Q/G+hEr91ic0kZZCGsXGXn7xYS6Zi+1wtvyfwSxseOaWssJhXyZjLNKb6UUv JMD+rX+WWN4xYegdmjU1CuggswCyho27MP92x8aLQQ4LEm+G1cnxj9l79fvuLcoCecpU5nzX+ NP8oZRG22CEqiGqRHqayunqLDU7MKdNf133D0bF0sGvBxDKweCzgZLreorLlH6Ud0Ke0c5s2t E7eCbRzYVJdETffCVBof/SJ24QkYCstB141hP/VsMNUqCx6ziJZl2ok2csQBDne8joI2jS7iX H8QisUMeRyuzrZZdylHCoT+Om7o3yZ7obKF7mn0E8rcq2istr7EE3bjiNZ2x+sSsXqPmKY73S N4gg3eIUwgucE+oHbw3xmnZ6kamh88AqngoliJJFNvk5emA+Zp7xI6S6bGorHsekXK2DlRHUn xJTPViMIlRgKYOfC3igQy3qtUn5iD5h/AaL4eu5jK2AY16ccFmr92y8xgBZb5EaFVF/kaF0jA UQhBjr+fAQ/i7I+k/ivPKQpvhwc9U6pfjA6lFT5vEex8DXMhJ1Nyi3LNf/IgRrxm+hfQEJTuF /o8aJHB/K64Y1I4iIcy0QuNSBG8RC2E/z/vI5m/iLAD5FwIIDj/YmtNIDrdRInzRgqMme3sls rzyTIJmyvPr6nI/Jzqy0kIb5i1w562DQH3bGMe/G//Z90R8xZCqLNGLNXtpDhGz9o9ABCsLiS zE6sYHa8ISYAtp+/DnrKGjZ0c495SfqJPlpbFwmpAEz9nUoJD9XQYDzbvEQaQs0Ar3wMulW4z 9NpPG3m 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 11:28:41 +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/main.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 350c9148340e..b3b5ded85166 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -457,8 +457,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, resp.response_length = offsetof(typeof(resp), response_length) + sizeof(resp.response_length); - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); err = -ENOMEM; if (!in_mad || !out_mad) goto out; @@ -471,8 +471,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, if (err) goto out; - memset(props, 0, sizeof *props); - + memset(props, 0, sizeof(*props)); have_ib_ports = num_ib_ports(dev->dev); props->fw_ver = dev->dev->caps.fw_ver; @@ -595,8 +594,8 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS; int err = -ENOMEM; - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!in_mad || !out_mad) goto out; @@ -771,8 +770,8 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index, int clear = 0; int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS; - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!in_mad || !out_mad) goto out; @@ -908,8 +907,8 @@ int __mlx4_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS; int err = -ENOMEM; - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!in_mad || !out_mad) goto out; @@ -1280,7 +1279,7 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev, struct mlx4_ib_pd *pd; int err; - pd = kmalloc(sizeof *pd, GFP_KERNEL); + pd = kmalloc(sizeof(*pd), GFP_KERNEL); if (!pd) return ERR_PTR(-ENOMEM); @@ -1319,7 +1318,7 @@ static struct ib_xrcd *mlx4_ib_alloc_xrcd(struct ib_device *ibdev, if (!(to_mdev(ibdev)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC)) return ERR_PTR(-ENOSYS); - xrcd = kmalloc(sizeof *xrcd, GFP_KERNEL); + xrcd = kmalloc(sizeof(*xrcd), GFP_KERNEL); if (!xrcd) return ERR_PTR(-ENOMEM); @@ -1367,7 +1366,7 @@ static int add_gid_entry(struct ib_qp *ibqp, union ib_gid *gid) struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); struct mlx4_ib_gid_entry *ge; - ge = kzalloc(sizeof *ge, GFP_KERNEL); + ge = kzalloc(sizeof(*ge), GFP_KERNEL); if (!ge) return -ENOMEM; @@ -2089,8 +2088,8 @@ static int init_node_data(struct mlx4_ib_dev *dev) int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS; int err = -ENOMEM; - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!in_mad || !out_mad) goto out; @@ -2600,7 +2599,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) if (num_ports == 0) return NULL; - ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); + ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof(*ibdev)); if (!ibdev) { dev_err(&dev->persist->pdev->dev, "Device struct alloc failed\n"); @@ -3301,12 +3300,12 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, break; case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: - ew = kmalloc(sizeof *ew, GFP_ATOMIC); + ew = kmalloc(sizeof(*ew), GFP_ATOMIC); if (!ew) break; INIT_WORK(&ew->work, handle_port_mgmt_change_event); - memcpy(&ew->ib_eqe, eqe, sizeof *eqe); + memcpy(&ew->ib_eqe, eqe, sizeof(*eqe)); ew->ib_dev = ibdev; /* need to queue only for port owner, which uses GEN_EQE */ if (mlx4_is_master(dev))