From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Luo bin <luobin9@huawei.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [kbuild] drivers/net/ethernet/huawei/hinic/hinic_debugfs.c:92 hinic_dbg_get_func_table() warn: returning -1 instead of -ENOMEM is sloppy
Date: Fri, 23 Jul 2021 10:53:36 +0300 [thread overview]
Message-ID: <202107231519.Yk44IWtF-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8baef6386baaefb776bdd09b5c7630cf057c51c6
commit: 5215e16244ee5889cc6135381acdbf4cbcb7905a hinic: add support to query function table
config: x86_64-randconfig-m001-20210723 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/net/ethernet/huawei/hinic/hinic_debugfs.c:92 hinic_dbg_get_func_table() warn: returning -1 instead of -ENOMEM is sloppy
vim +92 drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
5215e16244ee58 Luo bin 2020-08-28 83 static int hinic_dbg_get_func_table(struct hinic_dev *nic_dev, int idx)
5215e16244ee58 Luo bin 2020-08-28 84 {
5215e16244ee58 Luo bin 2020-08-28 85 struct tag_sml_funcfg_tbl *funcfg_table_elem;
5215e16244ee58 Luo bin 2020-08-28 86 struct hinic_cmd_lt_rd *read_data;
5215e16244ee58 Luo bin 2020-08-28 87 u16 out_size = sizeof(*read_data);
5215e16244ee58 Luo bin 2020-08-28 88 int err;
5215e16244ee58 Luo bin 2020-08-28 89
5215e16244ee58 Luo bin 2020-08-28 90 read_data = kzalloc(sizeof(*read_data), GFP_KERNEL);
5215e16244ee58 Luo bin 2020-08-28 91 if (!read_data)
5215e16244ee58 Luo bin 2020-08-28 @92 return ~0;
^^^^^^^^^
return -ENOMEM;
5215e16244ee58 Luo bin 2020-08-28 93
5215e16244ee58 Luo bin 2020-08-28 94 read_data->node = TBL_ID_FUNC_CFG_SM_NODE;
5215e16244ee58 Luo bin 2020-08-28 95 read_data->inst = TBL_ID_FUNC_CFG_SM_INST;
5215e16244ee58 Luo bin 2020-08-28 96 read_data->entry_size = HINIC_FUNCTION_CONFIGURE_TABLE_SIZE;
5215e16244ee58 Luo bin 2020-08-28 97 read_data->lt_index = HINIC_HWIF_FUNC_IDX(nic_dev->hwdev->hwif);
5215e16244ee58 Luo bin 2020-08-28 98 read_data->len = HINIC_FUNCTION_CONFIGURE_TABLE_SIZE;
5215e16244ee58 Luo bin 2020-08-28 99
5215e16244ee58 Luo bin 2020-08-28 100 err = hinic_port_msg_cmd(nic_dev->hwdev, HINIC_PORT_CMD_RD_LINE_TBL, read_data,
5215e16244ee58 Luo bin 2020-08-28 101 sizeof(*read_data), read_data, &out_size);
5215e16244ee58 Luo bin 2020-08-28 102 if (err || out_size != sizeof(*read_data) || read_data->status) {
5215e16244ee58 Luo bin 2020-08-28 103 netif_err(nic_dev, drv, nic_dev->netdev,
5215e16244ee58 Luo bin 2020-08-28 104 "Failed to get func table, err: %d, status: 0x%x, out size: 0x%x\n",
5215e16244ee58 Luo bin 2020-08-28 105 err, read_data->status, out_size);
5215e16244ee58 Luo bin 2020-08-28 106 kfree(read_data);
5215e16244ee58 Luo bin 2020-08-28 107 return ~0;
return -EIO;?
5215e16244ee58 Luo bin 2020-08-28 108 }
5215e16244ee58 Luo bin 2020-08-28 109
5215e16244ee58 Luo bin 2020-08-28 110 funcfg_table_elem = (struct tag_sml_funcfg_tbl *)read_data->data;
5215e16244ee58 Luo bin 2020-08-28 111
5215e16244ee58 Luo bin 2020-08-28 112 switch (idx) {
5215e16244ee58 Luo bin 2020-08-28 113 case VALID:
5215e16244ee58 Luo bin 2020-08-28 114 return funcfg_table_elem->dw0.bs.valid;
5215e16244ee58 Luo bin 2020-08-28 115 case RX_MODE:
5215e16244ee58 Luo bin 2020-08-28 116 return funcfg_table_elem->dw0.bs.nic_rx_mode;
5215e16244ee58 Luo bin 2020-08-28 117 case MTU:
5215e16244ee58 Luo bin 2020-08-28 118 return funcfg_table_elem->dw1.bs.mtu;
5215e16244ee58 Luo bin 2020-08-28 119 case RQ_DEPTH:
5215e16244ee58 Luo bin 2020-08-28 120 return funcfg_table_elem->dw13.bs.cfg_rq_depth;
5215e16244ee58 Luo bin 2020-08-28 121 case QUEUE_NUM:
5215e16244ee58 Luo bin 2020-08-28 122 return funcfg_table_elem->dw13.bs.cfg_q_num;
5215e16244ee58 Luo bin 2020-08-28 123 }
5215e16244ee58 Luo bin 2020-08-28 124
5215e16244ee58 Luo bin 2020-08-28 125 kfree(read_data);
5215e16244ee58 Luo bin 2020-08-28 126
5215e16244ee58 Luo bin 2020-08-28 127 return ~0;
return -EINVAL;
5215e16244ee58 Luo bin 2020-08-28 128 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
reply other threads:[~2021-07-23 7:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202107231519.Yk44IWtF-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=luobin9@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®