Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp381624pxa; Fri, 31 Jul 2020 14:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybxfzyt/jWKWMR9Ez8ZHYTR7/V8CuX2NhDBfcJJjY/3Tq6nKAjCdsT+kq8HPASs4kzNp5t X-Received: by 2002:a17:906:4d89:: with SMTP id s9mr5678187eju.365.1596232566424; Fri, 31 Jul 2020 14:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596232566; cv=none; d=google.com; s=arc-20160816; b=DWvEiLnnULccOpQ/kPY+/qtN8tQAtCNnaW6wHYshF+yMSay1ATgmXLmnK/e4OYZ1IY yRUyPh6GPb5LueJAURPeg+aeSdnR7Dicfi4t3APADU1moHTdkgQFNvPoE8R09Y+chMgc cw1nLlEBdt55iHe1s2nvSQMzQrnG6GNW22484/+uN3GI7bvBPtdyLzliaGC2P9ADkUX3 f1RZqQ6oS6kiCMb8com2tW20O9Grd0/gDl55qxQeeih1dFeGCmG8LenDEQoqP3SD3jlG ovTu7dsTx+2pC0wh1yq18p2oEbEtrvzJM+iOy3AhJvW0Cschpj+RDijIRsi8orx08nNb enAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=IREyWOnRtPYurDQBokCGrZOkPJGajEmSGqa5viO2V+Q=; b=w5FfL8ynCjTtSTpyT9hBeWODEfq9X57IYrpMIDJM610kNi27CHECVt66dQMNk472gO U7sko9ZcJr/Q9/fyTL1upiGBgu/ftbhnZn96+tCPZEzk6ntgMZFEeub9O81lctEZVQ+w 7SwihKH6+I81dDPpWwuVxk4ekhBcf6PSJZsds2cJ+EvFTVDKactFDi7D1EKt5MrQUiYi ws+WVOrrchPkDA5HWVanMYTK3DT1VMPWGsxpX6ug9LSVvW+SYmO/dWbnAJlKOUfN9A6K fjq2jas5duWxNlTwNmqkykiONf/st+hWmtNJ+0Mbx91Vm/dtaZHkx49M9yzfQ1W/FQCU StFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i28si6933924edj.373.2020.07.31.14.55.43; Fri, 31 Jul 2020 14:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbgGaVzb (ORCPT + 99 others); Fri, 31 Jul 2020 17:55:31 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39693 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbgGaVz3 (ORCPT ); Fri, 31 Jul 2020 17:55:29 -0400 Received: by mail-lj1-f195.google.com with SMTP id z4so3453016ljj.6; Fri, 31 Jul 2020 14:55:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IREyWOnRtPYurDQBokCGrZOkPJGajEmSGqa5viO2V+Q=; b=X/T0rGF3sWdQAuytOSgGqy93OWTVQlN7tAh7aCmxFFwmr7QIRfjqtqQOucvRXg7aNu iL3W6e4I9M4KORk4GK7CEhORLFj1O+R6ZAkMjygoqKBSU6SlbA/6EGJZGPJztD6jhGdQ +sEM2R6rWgA2bj8DJIyiTNbFzolePR+qRCG6fcrmFqHPlVV0jLXxS6a/iwyxME3+pgEP VFlTOBAU+w/joUS60hhrcMdaI9iaOj/Tr//HgzPujENVss5u0i9KyNqjucV1zaTqEn68 KK8Y6ApE1Q3hSHjzq54plKbVGUaABqeWyF70EhiVDmHQ+7PepKHdX3gkt4ESQRz+Qeeu vbvA== X-Gm-Message-State: AOAM531Vhu0cO9C41nv7fXazd2WPEyynDBxtNW/yeC47I6wShBpgcSbE mkFZ1TkrfxV7gxyR3pzUYJk= X-Received: by 2002:a2e:908a:: with SMTP id l10mr2537005ljg.409.1596232527161; Fri, 31 Jul 2020 14:55:27 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.googlemail.com with ESMTPSA id j144sm2674832lfj.54.2020.07.31.14.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 14:55:26 -0700 (PDT) From: Denis Efremov To: "Martin K. Petersen" , "James E.J. Bottomley" Cc: Denis Efremov , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: libcxgbi: use kvzalloc instead of opencoded kzalloc/vzalloc Date: Sat, 1 Aug 2020 00:55:24 +0300 Message-Id: <20200731215524.14295-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove cxgbi_alloc_big_mem(), cxgbi_free_big_mem() functions and use kvzalloc/kvfree instead. Signed-off-by: Denis Efremov --- drivers/scsi/cxgbi/libcxgbi.c | 8 ++++---- drivers/scsi/cxgbi/libcxgbi.h | 16 ---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4bc794d2f51c..a98b870eb1f3 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -77,9 +77,9 @@ int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base, { struct cxgbi_ports_map *pmap = &cdev->pmap; - pmap->port_csk = cxgbi_alloc_big_mem(max_conn * - sizeof(struct cxgbi_sock *), - GFP_KERNEL); + pmap->port_csk = kvzalloc(array_size(max_conn, + sizeof(struct cxgbi_sock *)), + GFP_KERNEL); if (!pmap->port_csk) { pr_warn("cdev 0x%p, portmap OOM %u.\n", cdev, max_conn); return -ENOMEM; @@ -124,7 +124,7 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) if (cdev->cdev2ppm) cxgbi_ppm_release(cdev->cdev2ppm(cdev)); if (cdev->pmap.max_connect) - cxgbi_free_big_mem(cdev->pmap.port_csk); + kvfree(cdev->pmap.port_csk); kfree(cdev); } diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 84b96af52655..321426242be4 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h @@ -537,22 +537,6 @@ struct cxgbi_task_data { #define iscsi_task_cxgbi_data(task) \ ((task)->dd_data + sizeof(struct iscsi_tcp_task)) -static inline void *cxgbi_alloc_big_mem(unsigned int size, - gfp_t gfp) -{ - void *p = kzalloc(size, gfp | __GFP_NOWARN); - - if (!p) - p = vzalloc(size); - - return p; -} - -static inline void cxgbi_free_big_mem(void *addr) -{ - kvfree(addr); -} - static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr) { if (chba->cdev->flags & CXGBI_FLAG_IPV4_SET) -- 2.26.2