On 9/8/2021 9:37 AM, Jiawen Wu wrote: > Add firmware version get operation. > > Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
<...> > +static int > +ngbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t > fw_size) > +{ > + struct ngbe_hw *hw = ngbe_dev_hw(dev); > + int ret; > + > + ret = snprintf(fw_version, fw_size, "0x%08x", hw->eeprom_id); > + > + if (ret < 0) > + return -EINVAL; > + > + ret += 1; /* add the size of '\0' */ > + if (fw_size < (size_t)ret) > + return ret; > + else > + return 0; You can drop 'else' leg of the branch. > + > + return 0; > +} > + <...>