From patchwork Thu Aug 3 08:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13339561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 314A7C00528 for ; Thu, 3 Aug 2023 08:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234873AbjHCI51 (ORCPT ); Thu, 3 Aug 2023 04:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234872AbjHCI51 (ORCPT ); Thu, 3 Aug 2023 04:57:27 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361AB171D for ; Thu, 3 Aug 2023 01:57:21 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-686ba97e4feso643052b3a.0 for ; Thu, 03 Aug 2023 01:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1691053040; x=1691657840; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=pfH3t1hsyk2OMXnzFT8U0rAy+VFps4+PGVaNguhLRRs=; b=ZhHkVuaeyw3K8p8NKxhFJ8Qf0HqNTXK88yH1Fw7L5Z4llhmKR1YPgY71Wzcb5Ci+63 9gEz18/ZhapVrB+IKvkLIhE4TocL1lg0IOfo2+WEo2n3fCpOFk4FrPpwF8QXyyPQdgKb UxPDfwNXTrFLg4YnSeUQjXo5zs76QDW8AbglQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691053040; x=1691657840; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pfH3t1hsyk2OMXnzFT8U0rAy+VFps4+PGVaNguhLRRs=; b=dZGyyiwfw+zMo2zMugvYwT0nD/CStibRwoypCU4jrctfW5f8BfkxTVlsIPr5TOTDnC 8jaQJcA8dzt+TOE60+rjZFTRDdtDoqn0k4jeXlqY2qvXjQnbdNn+8/tMSZ/LJMCPgToe a2IY3ZzroCxC58Kx5cIKUv5RAcAqq7LUxq98rCFYy+eY+KNStKi+6VrlCzsMbxxzx/uR g+bksYskz6Stk+CojL0GqHRkBe33OyJZ5peAFn0fQ4cqxAcPVoZFprPX2glzZxnMQKMK uRmmXZT9daXOXjk0Bn7ZEU81/4QeTNDgkxrqGDhaZA8CEg9L7hpKHNCXf8NuidPSte0P T05w== X-Gm-Message-State: ABy/qLbK1cW6e9v8+OIDlBmhtuDwF77gsgc/wIQX7GVamArbetfDsV3P weg9y4UxbF8+YdsMfg8i6jISmJmV/ATwE5Xm4Yk= X-Google-Smtp-Source: APBJJlFav4ppihA+5ktC+1OsnRJUtTW8GOTpzmNoG2IfifFLzwS9owLFpalenNVjU9PKr7Kjg3dWjQ== X-Received: by 2002:a05:6a00:14ca:b0:687:22ce:365f with SMTP id w10-20020a056a0014ca00b0068722ce365fmr18373749pfu.29.1691053040055; Thu, 03 Aug 2023 01:57:20 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x42-20020a056a000bea00b0068713008f98sm10289035pfu.129.2023.08.03.01.57.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2023 01:57:19 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Selvin Xavier Subject: [PATCH for-next v2 5/6] RDMA/bnxt_re: Avoid unnecessary memset Date: Thu, 3 Aug 2023 01:45:25 -0700 Message-Id: <1691052326-32143-6-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1691052326-32143-1-git-send-email-selvin.xavier@broadcom.com> References: <1691052326-32143-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP Avoid memset by initializing the variables during declaration itself. Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 1 - drivers/infiniband/hw/bnxt_re/main.c | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 1ce3922..003a07c 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -2797,7 +2797,6 @@ static int bnxt_re_post_recv_shadow_qp(struct bnxt_re_dev *rdev, struct bnxt_qplib_swqe wqe; int rc = 0; - memset(&wqe, 0, sizeof(wqe)); while (wr) { /* House keeping */ memset(&wqe, 0, sizeof(wqe)); diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 2fe47b3..c728694 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -395,10 +395,9 @@ static int bnxt_re_hwrm_qcfg(struct bnxt_re_dev *rdev, u32 *db_len, struct bnxt_en_dev *en_dev = rdev->en_dev; struct hwrm_func_qcfg_output resp = {0}; struct hwrm_func_qcfg_input req = {0}; - struct bnxt_fw_msg fw_msg; + struct bnxt_fw_msg fw_msg = {}; int rc; - memset(&fw_msg, 0, sizeof(fw_msg)); bnxt_re_init_hwrm_hdr((void *)&req, HWRM_FUNC_QCFG); req.fid = cpu_to_le16(0xffff); bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, @@ -969,7 +968,7 @@ static int bnxt_re_handle_unaffi_async_event(struct creq_func_event static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event, struct bnxt_re_qp *qp) { - struct ib_event event; + struct ib_event event = {}; unsigned int flags; if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR && @@ -979,7 +978,6 @@ static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event, bnxt_re_unlock_cqs(qp, flags); } - memset(&event, 0, sizeof(event)); if (qp->qplib_qp.srq) { event.device = &qp->rdev->ibdev; event.element.qp = &qp->ib_qp; @@ -1299,11 +1297,10 @@ static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev) { u32 prio_map = 0, tmp_map = 0; struct net_device *netdev; - struct dcb_app app; + struct dcb_app app = {}; netdev = rdev->netdev; - memset(&app, 0, sizeof(app)); app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; app.protocol = ETH_P_IBOE; tmp_map = dcb_ieee_getapp_mask(netdev, &app); @@ -1445,15 +1442,14 @@ static void bnxt_re_worker(struct work_struct *work) static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode) { + struct bnxt_re_ring_attr rattr = {}; struct bnxt_qplib_creq_ctx *creq; - struct bnxt_re_ring_attr rattr; u32 db_offt; int vid; u8 type; int rc; /* Registered a new RoCE device instance to netdev */ - memset(&rattr, 0, sizeof(rattr)); rc = bnxt_re_register_netdev(rdev); if (rc) { ibdev_err(&rdev->ibdev,