From patchwork Fri Feb 10 21:03:23 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: 9567509 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 8EB47602B6 for ; Fri, 10 Feb 2017 21:04:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE87285D6 for ; Fri, 10 Feb 2017 21:04:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73232285D9; Fri, 10 Feb 2017 21:04:07 +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 2F0D2285D6 for ; Fri, 10 Feb 2017 21:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751060AbdBJVEE (ORCPT ); Fri, 10 Feb 2017 16:04:04 -0500 Received: from mout.web.de ([217.72.192.78]:58597 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbdBJVED (ORCPT ); Fri, 10 Feb 2017 16:04:03 -0500 Received: from [192.168.1.2] ([77.182.113.129]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LZvcX-1c8yHY1KYf-00lnqy; Fri, 10 Feb 2017 22:03:25 +0100 Subject: [PATCH 3/5] IB/hfi1: Adjust another size determination in hfi1_user_sdma_alloc_queues() To: linux-rdma@vger.kernel.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty References: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <0fdf4d81-58d7-c6fc-b37f-41d47675dd83@users.sourceforge.net> Date: Fri, 10 Feb 2017 22:03:23 +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: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> X-Provags-ID: V03:K0:sIJZphdpiqnlj2OykVgNM2wThTNkTRoYT+LGdIrS3wv35W8g6g7 wQ/VY+q/4yvrCPAl0+mwNTKdOix9b8KKqxQRilvvQnQWA7e9EDTLRoB88Gk7UtIHccwN6qf JAyppOiLYGBAnRDM6ILwau0ygsEe8xk3qsCUNbDTsVCAEqGlK/L7sYyXUBkhjtLItTE08Ws Mv5VFVVIQ5FibKqC6n6TQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:4hoZZvC0j58=:QOCDligkhsOEbz4C/XA4GW v955DBONLefZ6hqyz1FUJlTqRUfcTX1BsIrUXpqk10oukNnVMMvtEQ96XOXJ5LigPPXRcY7NY LYrl57j03OPUhDdHo2c3j9XcRoYl42elktdx+8HKhrtzq/PytumsgoJAXEW80DOkj1teDFAOT 97pyV7HjqPa0yrWYltv07g49bDHtxz6AAI9vi7dwrxNT9wDXr3RlP9/0BE1zI+CuTnYvbC3Li b6OmzrqA7ce6PnCdNaP2ESdj+peYS+WdAt6Iyd3+uhJFP6hyaO1BCyCZ1Uy2tXMaebJcwqqNd BEXOXQzfDFUHWM5VDxP+HRRBG+P8h1GTBwOHG77lLVl3Oko6k7kOVWPDVRQXoRGKSprfzCLCU V8lHl+ig05Ip63zrPCZgYuKAoMHJI7/Em1sNvxUa17jIJruxSPKe0mgN2kBpl5OwQrfNedpTz AwtL2Cv+aWdELB+dcqAA2ZuRYQ5LWNHClwSo4Kp9gHwlXB+EYRVykR+DeK/uHnmWk0l7KFF7u 1bVeIaCZ8/pdewE1sc6gSjE1Lx0M6mTPeHJ0Wq9A0EOF8+3bXsp7ertvJMUQEnCaHx/ipkO2R 1U1A8ZiA9UH7TSvvt3cyKEi9JQVPsX+GfGxEIkoKbPb6BMXqNTGSQ9aErnHzUacAcI33Ll00M TbGiDBoPdEOcysuKN8QdpSZa88K8i/fLp/BOShPD3B7diP+pMzFBEMGFzq/M7RvR7XORPZNYP 8jzwQsqzzwfo6YCAYbvPjUMFomJ648D7Z+0/Gifg1mHRfbIJoRwLN3q2LmBAy1T3YODWda6py XAB7KZU 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: Fri, 10 Feb 2017 08:50:45 +0100 * Pass a product for a call of the function "vmalloc_user" without storing it in an intermediate variable. * Delete the local variable "memsize" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/hfi1/user_sdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 15194554a92b..991e7f3d8e18 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c @@ -375,7 +375,6 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) { struct hfi1_filedata *fd; int ret = 0; - unsigned memsize; char buf[64]; struct hfi1_devdata *dd; struct hfi1_user_sdma_comp_q *cq; @@ -443,8 +442,8 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) if (!cq) goto cq_nomem; - memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size); - cq->comps = vmalloc_user(memsize); + cq->comps = vmalloc_user(PAGE_ALIGN(sizeof(*cq->comps) + * hfi1_sdma_comp_ring_size)); if (!cq->comps) goto cq_comps_nomem;