Hello Piotr Kwapulinski,

Commit 23c0e5a16bcc ("ixgbe: Add link management support for E610
device") from Dec 5, 2024 (linux-next), leads to the following Smatch
static checker warning:

        drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c:1125 
ixgbe_is_media_cage_present()
        warn: signedness bug returning '(-95)'

drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
    1103 static bool ixgbe_is_media_cage_present(struct ixgbe_hw *hw)
                ^^^^
    1104 {
    1105         struct ixgbe_aci_cmd_get_link_topo *cmd;
    1106         struct ixgbe_aci_desc desc;
    1107 
    1108         cmd = &desc.params.get_link_topo;
    1109 
    1110         ixgbe_fill_dflt_direct_cmd_desc(&desc, 
ixgbe_aci_opc_get_link_topo);
    1111 
    1112         cmd->addr.topo_params.node_type_ctx =
    1113                 FIELD_PREP(IXGBE_ACI_LINK_TOPO_NODE_CTX_M,
    1114                            IXGBE_ACI_LINK_TOPO_NODE_CTX_PORT);
    1115 
    1116         /* Set node type. */
    1117         cmd->addr.topo_params.node_type_ctx |=
    1118                 FIELD_PREP(IXGBE_ACI_LINK_TOPO_NODE_TYPE_M,
    1119                            IXGBE_ACI_LINK_TOPO_NODE_TYPE_CAGE);
    1120 
    1121         /* Node type cage can be used to determine if cage is present. 
If AQC
    1122          * returns error (ENOENT), then no cage present. If no cage 
present then
                                   ^^^^^^

    1123          * connection type is backplane or BASE-T.
    1124          */
--> 1125         return ixgbe_aci_get_netlist_node(hw, cmd, NULL, NULL);

This is a bool function.  Based on the name, it should return true for
present and false for not but it does the reverse.  I don't know the code
well enough to say if the returns should be changed or the function name.

The comment says that ixgbe_aci_get_netlist_node() returns -ENOENT but
actually the only error code it returns is -EOPNOTSUPP.

    1126 }

regards,
dan carpenter

Reply via email to