Re: [PATCH V5 net-next 3/4] net: hns3: dump more reg info based on ras mod

Jijie Shao
2024-03-12T03:43:06Z

on 2024/3/12 11:03, Ratheesh Kannoth wrote:
> On 2024-03-09 at 15:30:43, Jijie Shao (shaojijie@huawei.com) wrote:
>> + }
>> +
>> + pos = scnprintf(buf, HCLGE_MOD_REG_INFO_LEN_MAX, "%s",
>> + reg_info[i].reg_name);
>> + if (reg_info[i].has_suffix)
>> + pos += scnprintf(buf + pos,
>> + HCLGE_MOD_REG_INFO_LEN_MAX - pos, "%u",
>> + le32_to_cpu(desc->data[0]));
>> + pos += scnprintf(buf + pos,
>> + HCLGE_MOD_REG_INFO_LEN_MAX - pos,
>> + ":");
>> + for (j = 0; j < reg_info[i].group_size; j++) {
>> + offset = reg_info[i].reg_offset_group[j];
>> + index = offset % HCLGE_DESC_DATA_LEN;
>> + bd_idx = offset / HCLGE_DESC_DATA_LEN;
>> + pos += scnprintf(buf + pos,
>> + HCLGE_MOD_REG_INFO_LEN_MAX - pos,
>> + " %08x",
>> + le32_to_cpu(desc[bd_idx].data[index]));
>> + }
>> + buf[pos] = '\0';
> ASFAIK, scnprintf does null terminate the string.

Yeah, you're right. I will send v6 to delete it