From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0CAA4596C; Thu, 12 Sep 2024 10:28:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D298B410D4; Thu, 12 Sep 2024 10:28:27 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 915BF410D4 for ; Thu, 12 Sep 2024 10:28:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726129705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qK/0H9pdoQwpF3lXBAtWHJUzFqomNFIXpI5p9O/Y9r4=; b=fvQFe1rxgU/9tqX1RIiuCfVERRsL7Ggk+vM1TBRTvkliMQ+TnCy5thQaVuKdxSmdA+k2hW FdL1+/409zYIJeII+PPxVC7B5cT0kTtIP9D/O2bWhf4EB/BzxtR9LrtUyx17rU0VY+S9me Q27AVRh6LeU8jh4vzw0d/r7614QOaOE= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-bWzJwd1aN6KnUa6-eyGLGw-1; Thu, 12 Sep 2024 04:28:23 -0400 X-MC-Unique: bWzJwd1aN6KnUa6-eyGLGw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AF507193E8C2; Thu, 12 Sep 2024 08:28:22 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.230]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7DF1719560B3; Thu, 12 Sep 2024 08:28:21 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Vamsi Attunuru Subject: [PATCH v2 13/14] net/octeon_ep: avoid warning on uninitialized variable Date: Thu, 12 Sep 2024 10:26:39 +0200 Message-ID: <20240912082643.1532679-14-david.marchand@redhat.com> In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com> References: <20240907145433.1479091-1-david.marchand@redhat.com> <20240912082643.1532679-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In the next commit, a (unrelated) change will be done on the logging macros in this driver. After this change, compilation with O3 fails with the following warning: ../drivers/net/octeon_ep/otx_ep_ethdev.c: In function ‘otx_ep_dev_mtu_set’: ../drivers/net/octeon_ep/otx_ep_ethdev.c:200:12: error: ‘devinfo.max_mtu’ may be used uninitialized [-Werror=maybe-uninitialized] 200 | if (mtu > devinfo.max_mtu) { | ^ ../drivers/net/octeon_ep/otx_ep_ethdev.c:186:33: note: ‘devinfo.max_mtu’ was declared here 186 | struct rte_eth_dev_info devinfo; | ^~~~~~~ cc1: all warnings being treated as errors The devinfo object is passed through otx_ep_dev_info_get() which initializes devinfo.max_mtu and returns 0. This return code is checked at line 189 and so devinfo.max_mtu is supposed to be initialized at this point. This seems like a compiler optimisation bug, but we will have to live with it. Signed-off-by: David Marchand --- drivers/net/octeon_ep/otx_ep_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c index c4a5a67c79..adc19c72b0 100644 --- a/drivers/net/octeon_ep/otx_ep_ethdev.c +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c @@ -186,6 +186,7 @@ otx_ep_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) struct rte_eth_dev_info devinfo; int32_t ret = 0; + memset(&devinfo, 0, sizeof(devinfo)); if (otx_ep_dev_info_get(eth_dev, &devinfo)) { otx_ep_err("Cannot set MTU to %u: failed to get device info", mtu); return -EPERM; -- 2.46.0