From patchwork Wed Aug 2 09:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13337945 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 62B74C04A94 for ; Wed, 2 Aug 2023 09:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbjHBJoi (ORCPT ); Wed, 2 Aug 2023 05:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233657AbjHBJof (ORCPT ); Wed, 2 Aug 2023 05:44:35 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F04DD1FEE for ; Wed, 2 Aug 2023 02:44:32 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a5ad44dc5aso5107609b6e.3 for ; Wed, 02 Aug 2023 02:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1690969472; x=1691574272; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=7ahXPbOxsVW240SaLBWtM4cdT5A9jytIJX6XJLo2rSQ=; b=DboH5MK3XbKzunAU29sFe+1nTHRs4MlkagwjHIgkpDUrzdkSTHP53nFxxsyfszl2ky KFuKw8qQjuDutrJw8jjXV5FHJZs2BdanGIzz/J8AGtxafqpn4t1ZxolfHNcVdKD+swXw grgtcDYNswt0ErSxNa4HOo85W1yKGhv7O5H7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690969472; x=1691574272; 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=7ahXPbOxsVW240SaLBWtM4cdT5A9jytIJX6XJLo2rSQ=; b=BV8vwpVPd63nKG4CvImGP8wPkARjVYq9ZO2ATH2w51M6NFKZlYsaxArrv311qkffec 9g0elBgZ+ArtMkKutAZiv7tSKGmntjwozWtJOj5+P5SSbC91Fm6bUsBd47ZO3Xi0Z3Mk 63Hybi1D+7RR5r+Q7mIPjt3CkG5KFnv+wuau9e/LSUdieFy5EVNSqBZzStkcH1N8ty4c 4zx9tia8mwjbBkZoqOOZHsF5gH7IBeb1w6IVW6fm6jQNJFYRKZA2ERLk1yEYIYoWDmHS iWRQjKMpREToxiFlsdyNrOHjzB9yDdGQvvMuekZKDZkF/XUKi7R12CpC2CE8r+LeQLqu ix7w== X-Gm-Message-State: ABy/qLZSJYi5AMgpX30AWNGDKI7Puxg0Ozl1gj51aaIF6CEoIm4Z9TU7 bs1h3Qs2lgP+KFO5ZWVz/75Jqw== X-Google-Smtp-Source: APBJJlEi35RpKcFA8a2hHMY6wK8NuJhAEKanYz/p/U54LdpQN9ki/3lisQKkq/3TEmK2U3txOAYNmg== X-Received: by 2002:a05:6808:2210:b0:3a3:6450:f5c4 with SMTP id bd16-20020a056808221000b003a36450f5c4mr18632966oib.4.1690969472055; Wed, 02 Aug 2023 02:44:32 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 5-20020a17090a000500b00263dfe9b972sm848790pja.0.2023.08.02.02.44.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2023 02:44:31 -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 5/6] RDMA/bnxt_re: Avoid unnecessary memset Date: Wed, 2 Aug 2023 02:32:38 -0700 Message-Id: <1690968759-9142-6-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1690968759-9142-1-git-send-email-selvin.xavier@broadcom.com> References: <1690968759-9142-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,