Re: [PATCH v23 net-next 05/12] net/nebula-matrix: add common resource implementation

Jakub Kicinski <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, 31 Jul 2026 17:42:28 +0800 illusion.wang wrote:
> From: illusion wang <[email protected]>
> 
> The Resource layer processes the entries/data of various modules within
> the processing chip to accomplish specific entry management operations,
> this describes the module business capabilities of the chip and the data
> it manages.
> The resource layer comprises the following sub-modules: common,
> interrupt, and vsi(txrx,queue not contained this time)
> 
> This patch provides the common part, including the conversion
> relationships among vsi_id, func_id, eth_id, and pf_id. These
> relationships may be utilized in the upper layer or the resource layer.
> 
> Key Assumptions:
> - nbl_res_start() initializes VSI/Eth/PF data structures **only for
> control devices** (`common->has_ctrl == true`).
> - APIs like nbl_res_func_id_to_vsi_id() **are guaranteed to be called
>  only on control devices** by the framework's dispatch layer.
> 
> Signed-off-by: illusion wang <[email protected]>

This generates a possibly transient warning when built with W=1

drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c:68:2: warning: variable 'eth_bitmap' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
   68 |         NBL_OPS_CALL(hw_ops->get_fw_eth_map,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                      (res_mgt->hw_ops_tbl->priv, &eth_bitmap));
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/../../nbl_include/nbl_include.h:39:6: note: expanded from macro 'NBL_OPS_CALL'
   39 |         if (_func)                              \
      |             ^~~~~
../drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c:70:6: note: uninitialized use occurs here
   70 |         if (eth_bitmap & ~((1 << NBL_MAX_ETHERNET) - 1)) {
      |             ^~~~~~~~~~
../drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c:68:2: note: remove the 'if' if its condition is always true
   68 |         NBL_OPS_CALL(hw_ops->get_fw_eth_map,
      |         ^
../drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/../../nbl_include/nbl_include.h:39:2: note: expanded from macro 'NBL_OPS_CALL'
   39 |         if (_func)                              \
      |         ^
../drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c:56:16: note: initialize the variable 'eth_bitmap' to silence this warning
   56 |         u32 eth_bitmap, eth_id;
      |                       ^
      |                        = 0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.