未验证 提交 18a355bf 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1597 Fix the bugs of 3SNIC driver compilation failure while using clang

Merge Pull Request from: @steven-song3 
 
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7PGHA
CVE:NA

 --------------------------------

1.fix a serial of uninitialized bugs 
2.fix the bug that expression does not compute the number of elements
Reviewed-by: NChen Mou <chenmou@3snic.com>
Reviewed-by: NWan Renyong <wanry@3snic.com>
Reviewed-by: NYang Gan <yanggan@3snic.com>
Reviewed-by: NWen Liang <wenliang@3snic.com>
Signed-off-by: NSteven Song <steven.song@3snic.com>

==================================
Test:
compille: pass
insmod/rmmod: pass
iperf: Pass 
 
Link:https://gitee.com/openeuler/kernel/pulls/1597 

Reviewed-by: Jason Zeng <jason.zeng@intel.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -217,7 +217,7 @@ static unsigned char sss_get_pci_bus_id(struct sss_pci_adapter *adapter)
return bus_id;
}
static bool sss_alloc_card_id(void)
static bool sss_alloc_card_id(u8 *id)
{
unsigned char i;
......@@ -225,6 +225,7 @@ static bool sss_alloc_card_id(void)
for (i = 0; i < SSS_CARD_CNT_MAX; i++) {
if (test_and_set_bit(i, &g_index_bit_map) == 0) {
sss_chip_node_unlock();
*id = i;
return true;
}
}
......@@ -233,10 +234,15 @@ static bool sss_alloc_card_id(void)
return false;
}
static void sss_free_card_id(u8 id)
{
clear_bit(id, &g_index_bit_map);
}
int sss_alloc_chip_node(struct sss_pci_adapter *adapter)
{
struct sss_card_node *chip_node = NULL;
unsigned char i;
unsigned char card_id;
unsigned char bus_id;
bus_id = sss_get_pci_bus_id(adapter);
......@@ -250,14 +256,15 @@ int sss_alloc_chip_node(struct sss_pci_adapter *adapter)
chip_node->bus_id = bus_id;
if (snprintf(chip_node->chip_name, IFNAMSIZ, "%s%u", SSS_CHIP_NAME, i) < 0) {
if (!sss_alloc_card_id(&card_id)) {
kfree(chip_node);
sdk_err(&adapter->pcidev->dev, "chip node is exceed\n");
return -EINVAL;
}
if (!sss_alloc_card_id()) {
if (snprintf(chip_node->chip_name, IFNAMSIZ, "%s%u", SSS_CHIP_NAME, card_id) < 0) {
sss_free_card_id(card_id);
kfree(chip_node);
sdk_err(&adapter->pcidev->dev, "chip node is exceed\n");
return -EINVAL;
}
......
......@@ -302,7 +302,7 @@ int sss_hwif_init_ceq(struct sss_hwdev *hwdev)
act_num = sss_alloc_irq(hwdev, SSS_SERVICE_TYPE_INTF, irq_desc, ceq_num);
if (act_num == 0) {
sdk_err(hwdev->dev_hdl, "Fail to alloc irq, ceq_num: %u\n", ceq_num);
return ret;
return -EINVAL;
}
if (act_num < ceq_num) {
......
......@@ -293,7 +293,7 @@ static int sss_init_ctrlq(struct sss_hwdev *hwdev)
{
u8 i;
u8 q_type;
int ret;
int ret = -ENOMEM;
struct sss_ctrlq_info *ctrlq_info = NULL;
ctrlq_info = kzalloc(sizeof(*ctrlq_info), GFP_KERNEL);
......
......@@ -104,7 +104,7 @@ static void sss_nic_fill_indir_tbl(struct sss_nic_rss_indirect_table *indir_tbl,
indir_tbl->entry[i] = (u16)indir_table[i];
temp_entry = (u32 *)indir_tbl->entry;
tbl_size = sizeof(indir_tbl->entry) / sizeof(u32);
tbl_size = sizeof(indir_tbl->entry) / (sizeof(u32));
for (i = 0; i < tbl_size; i++)
temp_entry[i] = cpu_to_be32(temp_entry[i]);
}
......
......@@ -674,9 +674,9 @@ do { \
#define sss_nic_xdp_update_rx_info(rq_desc, wqe_num) \
do { \
struct sss_nic_rx_desc *_rx_desc = NULL; \
u16 _wqe_num = wqe_num; \
u16 _wqe_cnt = wqe_num; \
\
while (_wqe_num > 0) { \
while (_wqe_cnt > 0) { \
_rx_desc = &(rq_desc)->rx_desc_group[(rq_desc)->ci & (rq_desc)->qid_mask]; \
if (likely(page_to_nid(_rx_desc->page) == numa_node_id())) \
sss_nic_rx_reuse_dma_page((rq_desc), _rx_desc); \
......@@ -686,7 +686,7 @@ do { \
_rx_desc->buf_daddr = 0; \
_rx_desc->page = NULL; \
\
_wqe_num--; \
_wqe_cnt--; \
} \
} while (0)
......
......@@ -666,7 +666,7 @@ static netdev_tx_t sss_nic_send_one_skb(struct sk_buff *skb,
struct sss_nic_sq_desc *sq_desc)
{
u32 qinfo = 0;
u32 offload;
u32 offload = 0;
u16 pi = 0;
u16 owner;
u16 sge_cnt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册