From patchwork Sat May 27 19:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 99855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp550873vqr; Sat, 27 May 2023 12:53:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72QpLPK0Z2O+8VIFhHAz82HO0wqEn3ieJf8IorO/aw/wnmYa0KtfAa5ymxzDkgHAW++BCR X-Received: by 2002:a05:6a00:22c2:b0:643:ba77:f265 with SMTP id f2-20020a056a0022c200b00643ba77f265mr11013502pfj.25.1685217231554; Sat, 27 May 2023 12:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685217231; cv=none; d=google.com; s=arc-20160816; b=ew9CjWkXtyxjGX6aadYVzxjIqmP0ZBgtbMV+UUWct+h/VK+UCEqhWdYdiRz0bh136v ILFLCu2xBfDivGZGViWzTqOIugEeZFdEek2sk2qaraBiFHb25yAq547v4XgKF9bwPLlT GXUQBHX0yvWwGoca3V8T2IJAgkSiMSfPbaAdErOw9u93HX3OLdpsc2x41EJZ4oN6d5xK h5/6t+3aqqQSv7e32Ud3H6XW43DI9zZtKMNKILpw+QOboTuHxTGtey+ICKgFNzEaHTM3 RZPa410qnuy8jL1U8E6by5pysOhY4YoSEFrDymm/zn70tgWqZ+lKJmYFAw23nhfgWyuo K5ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=VKthlyn9E+U4rCBy7ij6kRftfxuaXpwhoHRrC4eHBog=; b=ds9OBddeUgYoFI3YJ4z1vbAl1lyUZQsxJhkEsMAFgG00QPtye1rT31vf5QSAaXpIic HF+xYoaIpRM9uC3Y40xRRxMDWDfIwvezD77zNTX2/LFAtHDGykeGx8zXXQiDFNjXrZcz 1LNm1AvEESyRXTuAGZzgQaK+Yrxr7XwPOn3fHLqQqua6N1AeEG7NeSk+GFM+YA63B/7W nGNLVVMx9E9o4AEuLP/QdkEGAC7Tw3GBdUtnm6jfQ0gK19OrlsmrgnfQd4YcfjWptdh1 lMq5czgFf0bvW2FN2UzTUyDjwwOa15qJAl8kpOxaa1QgZ4j9AdA55YQFvfZik1Vg63Cr PMvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=mG4kTaBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020aa79425000000b0063afe9f1fb1si4853477pfo.119.2023.05.27.12.53.36; Sat, 27 May 2023 12:53:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=mG4kTaBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229596AbjE0TkT (ORCPT + 99 others); Sat, 27 May 2023 15:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjE0TkQ (ORCPT ); Sat, 27 May 2023 15:40:16 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CFE7D9 for ; Sat, 27 May 2023 12:40:14 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 2zlqqt6LYzb8g2zlqqY7Te; Sat, 27 May 2023 21:40:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685216412; bh=VKthlyn9E+U4rCBy7ij6kRftfxuaXpwhoHRrC4eHBog=; h=From:To:Cc:Subject:Date; b=mG4kTaBcbdVgJxb642fw9xT4sANB4RsAO2haUtUX9fe7eNV41iuffXUFBlfXvzRCa xm5NRBMB1GSBRPb0Kb6/cY2F/Ikzq99aceXqkcXapTgNDYe5awbRfSTnYi3BRMtJ+u 7XXWgSEo+20gE6IjEEIEAJ7tjBM8EWA+AQrD2uGJ9o9iBSr0mN/cssERJj15ZgwBiB WWZNRBYsoYGlEarqTmPGoCmdocT5A6ohz/htXTajhFihPOvw7XoSZZmU7IFZ1ZHr8y y1fDYxAo0fnLkBX5B1ctnql9gHDL2Cy+rrplV+XFhX4UpwN3Q9N/1NWzuXs+fYc0q+ cNnm/rZj5BovA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 27 May 2023 21:40:12 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Derek Chickles , Satanand Burla , Felix Manlunas , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org Subject: [PATCH net-next] liquidio: Use vzalloc() Date: Sat, 27 May 2023 21:40:08 +0200 Message-Id: <93b010824d9d92376e8d49b9eb396a0fa0c0ac80.1685216322.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767078343699590021?= X-GMAIL-MSGID: =?utf-8?q?1767078343699590021?= Use vzalloc() instead of hand writing it with vmalloc()+memset(). This is less verbose. Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c | 4 +--- drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c index 9ed3d1ab2ca5..285d3825cad3 100644 --- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c +++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c @@ -719,12 +719,10 @@ static int cn23xx_setup_pf_mbox(struct octeon_device *oct) for (i = 0; i < oct->sriov_info.max_vfs; i++) { q_no = i * oct->sriov_info.rings_per_vf; - mbox = vmalloc(sizeof(*mbox)); + mbox = vzalloc(sizeof(*mbox)); if (!mbox) goto free_mbox; - memset(mbox, 0, sizeof(struct octeon_mbox)); - spin_lock_init(&mbox->lock); mbox->oct_dev = oct; diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c index fda49404968c..b3bd2767d3dd 100644 --- a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c +++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c @@ -279,12 +279,10 @@ static int cn23xx_setup_vf_mbox(struct octeon_device *oct) { struct octeon_mbox *mbox = NULL; - mbox = vmalloc(sizeof(*mbox)); + mbox = vzalloc(sizeof(*mbox)); if (!mbox) return 1; - memset(mbox, 0, sizeof(struct octeon_mbox)); - spin_lock_init(&mbox->lock); mbox->oct_dev = oct;