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 3DFAB45AAF; Fri, 4 Oct 2024 18:26:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25DCA42ED4; Fri, 4 Oct 2024 18:24:48 +0200 (CEST) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mails.dpdk.org (Postfix) with ESMTP id DE32442E70 for ; Fri, 4 Oct 2024 18:24:37 +0200 (CEST) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-71b8d10e9b3so1793998b3a.3 for ; Fri, 04 Oct 2024 09:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728059077; x=1728663877; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GcoqL07MfNW8B1z/rm4M1bxTIrdRLgWMEl9LpIA8Isw=; b=18FlbOw3gxwmPOT6afvbpNBOJEN5mc0G8i9Lx6iubFiMPUAuN2ndOihdDAwHo2OGgU B6L4NbOgmCaMFtmqAJNGluhT+0FRQYhD3KD0uAdFwbXJjytFHszfIfLn+jHMPnjhJXK7 eAxoqXqHts4hV2fywV4fXRzwnIU98UO1c/igLPUlb5nnMSHMWmZt5kw4phJ78h+lTjAJ I+FYju3blceWQMZsvoA6OGHFhmfflxibNbCxwk4p7ZStdUKOo4x3E1R7Adtm+rEPHhG9 yt+HrD6vUqOct+WrGcSHKTcXztsVNKshnqLm2wvovRZTTHNrM7mS7vlzYY4ScqHcP2CC iHQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059077; x=1728663877; h=content-transfer-encoding:mime-version: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=GcoqL07MfNW8B1z/rm4M1bxTIrdRLgWMEl9LpIA8Isw=; b=Kc68LPhYgHcB9PXZ5D6/12lFKAw9pkrV4Hh2vquhlqPkwGhZXsLDlfHCu1cMir0pAs 0acxV8ZXJd8PlLjIGbFLNtYNpzyC38B7XrcIgV2aL9zGv/EAmCYyP722n3r7MUpW3HE2 YMawp4awEEJ/t/c6P0tZ8Rr1m40FDR2kSDOiyvh4PMhqeDejO5xx2GqWOFY6R2oGHwnO ArkMg8srlKgdnepPYuZYNgU1P7omP+TyKNEEJIBs+Uf68uel+f7UuSz1ZiDCQMIWgx7Y TqF7chRwTfRd46x/IGrfthZUum6OS/4tAIALxl4gccOrSZ+KFcysJk2DdaJqhJPNAI4l PRiA== X-Gm-Message-State: AOJu0YyHU294p/x6vnBmSVRPd/DyQ5ZgGB/9Ty+y/3hI+Ib9FIjX++h3 8G19qkWCuU1AHaoJbrb7ygNRaTGxcRrqbVgFdajPnNLgY6kPa4rBV43CpqdM2+SXdHEBlQXXUvi Y41q65Q== X-Google-Smtp-Source: AGHT+IGofpwHKjVwfo5GFvKwnXbZICCAjWnDpNxCOcnCgrt4o7S92RqbIE9q/a3mETSr9aHiW+eHKA== X-Received: by 2002:a05:6a21:1190:b0:1d5:135b:4ac6 with SMTP id adf61e73a8af0-1d6dfaef840mr4544842637.48.1728059077019; Fri, 04 Oct 2024 09:24:37 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f680d7a1sm139231a12.19.2024.10.04.09.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:24:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 10/10] ethdev: require checking results of info_get functions Date: Fri, 4 Oct 2024 09:21:57 -0700 Message-ID: <20241004162418.52940-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162418.52940-1-stephen@networkplumber.org> References: <20241004162418.52940-1-stephen@networkplumber.org> MIME-Version: 1.0 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 With functions that return a data structure, the application must check the return value since the data structure contents will be undefined in case of error. Signed-off-by: Stephen Hemminger --- lib/ethdev/rte_ethdev.h | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 548fada1c7..3df8b73175 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -3058,7 +3058,8 @@ int rte_eth_allmulticast_get(uint16_t port_id); * - (-ENODEV) if *port_id* invalid. * - (-EINVAL) if bad parameter. */ -int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link); +int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link) + __rte_warn_unused_result; /** * Retrieve the link status (up/down), the duplex mode (half/full), @@ -3074,7 +3075,8 @@ int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link); * - (-ENODEV) if *port_id* invalid. * - (-EINVAL) if bad parameter. */ -int rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link); +int rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link) + __rte_warn_unused_result; /** * @warning @@ -3408,7 +3410,8 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma, * - (-ENODEV) if *port_id* invalid. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info); +int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) + __rte_warn_unused_result; /** * @warning @@ -3426,7 +3429,8 @@ int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info); * - (-EINVAL) if bad parameter. */ __rte_experimental -int rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf); +int rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf) + __rte_warn_unused_result; /** * Retrieve the firmware version of a device. @@ -3448,8 +3452,8 @@ int rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf); * - (>0) if *fw_size* is not enough to store firmware version, return * the size of the non truncated string. */ -int rte_eth_dev_fw_version_get(uint16_t port_id, - char *fw_version, size_t fw_size); +int rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) + __rte_warn_unused_result; /** * Retrieve the supported packet types of an Ethernet device. @@ -3491,7 +3495,9 @@ int rte_eth_dev_fw_version_get(uint16_t port_id, * - (-EINVAL) if bad parameter. */ int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, - uint32_t *ptypes, int num); + uint32_t *ptypes, int num) + __rte_warn_unused_result; + /** * Inform Ethernet device about reduced range of packet types to handle. * @@ -5089,7 +5095,8 @@ int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id, * - (-EIO) if device is removed. * - others depends on the specific operations implementation. */ -int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info); +int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info) + __rte_warn_unused_result; /** * Retrieve size of device EEPROM @@ -5161,8 +5168,8 @@ int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info); */ __rte_experimental int -rte_eth_dev_get_module_info(uint16_t port_id, - struct rte_eth_dev_module_info *modinfo); +rte_eth_dev_get_module_info(uint16_t port_id, struct rte_eth_dev_module_info *modinfo) + __rte_warn_unused_result; /** * @warning @@ -5185,8 +5192,8 @@ rte_eth_dev_get_module_info(uint16_t port_id, */ __rte_experimental int -rte_eth_dev_get_module_eeprom(uint16_t port_id, - struct rte_dev_eeprom_info *info); +rte_eth_dev_get_module_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info) + __rte_warn_unused_result; /** * Set the list of multicast addresses to filter on an Ethernet device. @@ -6839,7 +6846,8 @@ rte_eth_recycle_mbufs(uint16_t rx_port_id, uint16_t rx_queue_id, * - (-EINVAL) if bad parameter. */ __rte_experimental -int rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint32_t *ptypes, int num); +int rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint32_t *ptypes, int num) + __rte_warn_unused_result; /** * @warning -- 2.45.2