[RFC 13/18] net/hinic3: add dev ops

Stephen Hemminger stephen at networkplumber.org
Thu Jun 26 23:29:12 CEST 2025


On Fri, 18 Apr 2025 17:05:59 +0800
Feifei Wang <wff_light at vip.163.com> wrote:

> +static int
> +hinic3_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
> +{
> +	struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
> +	char mgmt_ver[MGMT_VERSION_MAX_LEN] = {0};
> +	int err;
> +
> +	err = hinic3_get_mgmt_version(nic_dev->hwdev, mgmt_ver,
> +				      HINIC3_MGMT_VERSION_MAX_LEN);
> +	if (err) {
> +		PMD_DRV_LOG(ERR, "Get fw version failed");
> +		return -EIO;
> +	}
> +
> +	if (fw_size < strlen((char *)mgmt_ver) + 1)
> +		return (strlen((char *)mgmt_ver) + 1);
> +

Why are you cast a string (char *) to char * here?


More information about the dev mailing list