From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BBB3C33CB7 for ; Tue, 28 Jan 2020 02:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7B292467B for ; Tue, 28 Jan 2020 02:44:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="fefgM4+N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbgA1CoJ (ORCPT ); Mon, 27 Jan 2020 21:44:09 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:46243 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726164AbgA1CoJ (ORCPT ); Mon, 27 Jan 2020 21:44:09 -0500 Received: by mail-io1-f68.google.com with SMTP id t26so12537097ioi.13 for ; Mon, 27 Jan 2020 18:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4zFXaMWNO3tHiDo5gDvMo0NiYjdpSO18GeIMVZK3QZQ=; b=fefgM4+NwyCBXqIXZ7AcDcoNBcaYIWmzcPnQhMM+jQma3PpXdpZZCY1WktoA+xXqse frphedm3BbxCMsV9gQGag2/9gOcw9bHsokrVin2A06LB+lRPE+MGfyKLynZE+m9qzYjf LG8Yu7OuFyJGSfj25dxnDwhEjDJ6oMBcX2mN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4zFXaMWNO3tHiDo5gDvMo0NiYjdpSO18GeIMVZK3QZQ=; b=CJWo5CC3rx9ROn6sMs/A6arLhYlKNVumeO58dVnT+dNZgqFTB3oxMrUoNKxUo2+ien fMmMiwxHLBmk7r1S6B4FhauAr0JqhHbD9Eho7U+RZtSAyEW+h7z9YWdLQpx7fQQHM6gY esx9BlxUAX+hHFDs1PUxoOeUsPvs2sHat1AETMCnrG7P/jG4NFQu5iC1rN8nefipUIyR 08Rao7XNU5Wwldeg8JXUMTL98fQSRCdnvclBT9Vfd44sARE89ElRVPsLdADQ5ZkmeKTU P2z+aQNsGLB5Zqcs8xCyZLznh6QokgYGlesqR38Nxp8NXczxLGp4nuusz4dUB8o8qWJa ehjw== X-Gm-Message-State: APjAAAVQRLOEVxVYyOH9JyPrRaWZp6oif6QDh6AryQVq6Y7ep/kJW1K6 iPxsWE2zwhKVNZYNfv1pioxtyAwgFV4M86E0PtIZpA== X-Google-Smtp-Source: APXvYqwJevnyV3l/sFjHCxvagVTu6RqGAD4N4HcwWwbmlZcgVs+tVOn9u5ToM6k8hlABrB5ourCVVPGNuPweFNfGazc= X-Received: by 2002:a6b:c9c6:: with SMTP id z189mr14656306iof.285.1580179447850; Mon, 27 Jan 2020 18:44:07 -0800 (PST) MIME-Version: 1.0 References: <1579845165-18002-1-git-send-email-devesh.sharma@broadcom.com> <1579845165-18002-5-git-send-email-devesh.sharma@broadcom.com> <20200126142928.GG2993@unreal> <20200128003537.GD21192@mellanox.com> In-Reply-To: <20200128003537.GD21192@mellanox.com> From: Devesh Sharma Date: Tue, 28 Jan 2020 08:13:31 +0530 Message-ID: Subject: Re: [PATCH for-next 4/7] RDMA/bnxt_re: Refactor net ring allocation function To: Jason Gunthorpe Cc: Leon Romanovsky , linux-rdma , Doug Ledford Content-Type: text/plain; charset="UTF-8" Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Jan 28, 2020 at 6:05 AM Jason Gunthorpe wrote: > > On Mon, Jan 27, 2020 at 01:10:10PM +0530, Devesh Sharma wrote: > > > > static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) > > > > { > > > > + struct bnxt_qplib_ctx *qplib_ctx; > > > > + struct bnxt_re_ring_attr rattr; > > > > int num_vec_created = 0; > > > > - dma_addr_t *pg_map; > > > > int rc = 0, i; > > > > - int pages; > > > > u8 type; > > > > > > > > + memset(&rattr, 0, sizeof(rattr)); > > > > > > Initialize rattr to zero from the beginning and save call to memset. > > I moved from static initialization to memset due to some sparse/smatch > > warnings, rattr has a "pointer member". > > That is why you need to use = {} not the weird '= {0}' version > > 0 initializes the first member to zero and default initializes the rest > which doesn't work properly if the first member is not an integral > value. > So should I remove memset(s) in v2? > Jason