From patchwork Wed Apr 5 13:55:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9664173 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 1BAB6602B8 for ; Wed, 5 Apr 2017 14:00:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C43D28563 for ; Wed, 5 Apr 2017 14:00:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00A4D28587; Wed, 5 Apr 2017 14:00:33 +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 A24C828563 for ; Wed, 5 Apr 2017 14:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753899AbdDEN5l (ORCPT ); Wed, 5 Apr 2017 09:57:41 -0400 Received: from mout.web.de ([217.72.192.78]:59499 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932810AbdDEN4A (ORCPT ); Wed, 5 Apr 2017 09:56:00 -0400 Received: from [192.168.1.2] ([77.182.172.209]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MKrU4-1cvlPQ3j1c-0007ue; Wed, 05 Apr 2017 15:55:41 +0200 Subject: [PATCH 5/5] IB/qib: Adjust two size determinations in qib_init_pportdata() From: SF Markus Elfring To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Wed, 5 Apr 2017 15:55:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:+mfDQy+JT6++tTtsBBX85cGmQOjlwtBOuXRadEuDoxDx9OOUd1F lvWcYTeh1wd72ZSsfvX9DMed4kHH92R2j5y3BBZjo+Jpe4q0qv1dvCYb+oV2C+4doao8rkp +MpSXTbBd4h/RT/ky8uTc3XEFFvdhysaxTkbQVgT6i31DoS1tJQRh8ntVdmE9ImamSkFzH3 atx8vY9ivUV0RxJlf4H+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:yf+rU3AgTf8=:P0tk8KvMB/lgzC4VHyceNE 7e60xGK+FSlF88bMk0My+qvcDssDNnV+HY7oG01OEKD/FfS/Y8z04hTw7cnJt1PDxE5mU7vwg JyNIHWvYgY99wK+EqsuI561seSnt6hA7kqkU0KvvYvcRvh2wT9hOgTix1d+/tUo57/Rpf/Hjq +oZ/igmCRGCVWNyUHa3ucRRMwv/AOAwUP+xx4Svh365twgoc/zynJI6loH63mPvChH4FaScms b6f2WrKjc34h8uqoqKP/GOiTRfFmdZnwyaLLgfZubFucAhx5wKV9VsFmIo0/OKTIpsA/oUQY6 fnZbNoMc0pJgVFrMR0KTHau68tHDYN4Q9ISrdPNR7m9qhSeStEh+XvWqXryzkX4Trf5WEqPrt aQGboiakhitJhoVS6oqks06CCuMyI5pMkGiuMx/kNTW98Np9iG1ENLpSzCwqlozZqdiWZjrlo 9aL8yLMX/Qr8QGtSyd1EZe1kwKgYwLZFsAGautK8X5tef+5BFxXF0iYl7ejbX1Kwxei7uSwTm 4h0apqrar2jZrR/WC2fmdPFN7LiRW4LomzJt0EXwGfGVg0IY2/rix/Hz88B2yAap6dmH26Paq KmNnm8jnqgcdfoAzvBTR76Xyhf9ed7YTNhByd3pUWJiM+YCg9ajDT3dKSIzHyH8Nfs/JeEZwC dZoIfklZyH9rPzy1DcJ4JSS1bCu2XkHIKpMd7/cZe6zfC/lGgiUV0we6DkpGAoINsvsqldfaB DhfM/XTmM366VVkG/KsrahwzPbhHUokS2NVsZW0HRL/8SuZk2t+a6YK5As8BDSrssoE91mfny r++OAMr 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: Wed, 5 Apr 2017 15:00:44 +0200 * Replace the specification of two data structures by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. * Delete the local variable "size" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring Reviewed-by: Yuval Shaia --- drivers/infiniband/hw/qib/qib_init.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 101580f0460a..e223226ed94d 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c @@ -222,8 +222,6 @@ struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *ppd, u32 ctxt, int qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, u8 hw_pidx, u8 port) { - int size; - ppd->dd = dd; ppd->hw_pidx = hw_pidx; ppd->port = port; /* IB port number, not index */ @@ -270,13 +268,14 @@ int qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, if (!ppd->congestion_entries) goto bail_1; - size = sizeof(struct cc_table_shadow); - ppd->ccti_entries_shadow = kzalloc(size, GFP_KERNEL); + ppd->ccti_entries_shadow = kzalloc(sizeof(*ppd->ccti_entries_shadow), + GFP_KERNEL); if (!ppd->ccti_entries_shadow) goto bail_2; - size = sizeof(struct ib_cc_congestion_setting_attr); - ppd->congestion_entries_shadow = kzalloc(size, GFP_KERNEL); + ppd->congestion_entries_shadow = kzalloc(sizeof(*ppd + ->congestion_entries_shadow), + GFP_KERNEL); if (!ppd->congestion_entries_shadow) goto bail_3;