Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-02-06 (igb, igc) This series contains updates to igb and igc drivers. Kunwu Chan adjusts firmware version string implementation to resolve possible NULL pointer issue for igb. Sasha removes workaround on igc. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: igc: Remove temporary workaround igb: Fix string truncation warnings in igb_set_fw_version ==================== Link: https://lore.kernel.org/r/20240214180347.3219650-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
c40c0d3a76
@ -637,7 +637,7 @@ struct igb_adapter {
|
||||
struct timespec64 period;
|
||||
} perout[IGB_N_PEROUT];
|
||||
|
||||
char fw_version[32];
|
||||
char fw_version[48];
|
||||
#ifdef CONFIG_IGB_HWMON
|
||||
struct hwmon_buff *igb_hwmon_buff;
|
||||
bool ets;
|
||||
|
@ -3069,7 +3069,6 @@ void igb_set_fw_version(struct igb_adapter *adapter)
|
||||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct e1000_fw_version fw;
|
||||
char *lbuf;
|
||||
|
||||
igb_get_fw_version(hw, &fw);
|
||||
|
||||
@ -3077,34 +3076,36 @@ void igb_set_fw_version(struct igb_adapter *adapter)
|
||||
case e1000_i210:
|
||||
case e1000_i211:
|
||||
if (!(igb_get_flash_presence_i210(hw))) {
|
||||
lbuf = kasprintf(GFP_KERNEL, "%2d.%2d-%d",
|
||||
fw.invm_major, fw.invm_minor,
|
||||
fw.invm_img_type);
|
||||
snprintf(adapter->fw_version,
|
||||
sizeof(adapter->fw_version),
|
||||
"%2d.%2d-%d",
|
||||
fw.invm_major, fw.invm_minor,
|
||||
fw.invm_img_type);
|
||||
break;
|
||||
}
|
||||
fallthrough;
|
||||
default:
|
||||
/* if option rom is valid, display its version too */
|
||||
if (fw.or_valid) {
|
||||
lbuf = kasprintf(GFP_KERNEL, "%d.%d, 0x%08x, %d.%d.%d",
|
||||
fw.eep_major, fw.eep_minor,
|
||||
fw.etrack_id, fw.or_major, fw.or_build,
|
||||
fw.or_patch);
|
||||
snprintf(adapter->fw_version,
|
||||
sizeof(adapter->fw_version),
|
||||
"%d.%d, 0x%08x, %d.%d.%d",
|
||||
fw.eep_major, fw.eep_minor, fw.etrack_id,
|
||||
fw.or_major, fw.or_build, fw.or_patch);
|
||||
/* no option rom */
|
||||
} else if (fw.etrack_id != 0X0000) {
|
||||
lbuf = kasprintf(GFP_KERNEL, "%d.%d, 0x%08x",
|
||||
fw.eep_major, fw.eep_minor,
|
||||
fw.etrack_id);
|
||||
snprintf(adapter->fw_version,
|
||||
sizeof(adapter->fw_version),
|
||||
"%d.%d, 0x%08x",
|
||||
fw.eep_major, fw.eep_minor, fw.etrack_id);
|
||||
} else {
|
||||
lbuf = kasprintf(GFP_KERNEL, "%d.%d.%d", fw.eep_major,
|
||||
fw.eep_minor, fw.eep_build);
|
||||
snprintf(adapter->fw_version,
|
||||
sizeof(adapter->fw_version),
|
||||
"%d.%d.%d",
|
||||
fw.eep_major, fw.eep_minor, fw.eep_build);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* the truncate happens here if it doesn't fit */
|
||||
strscpy(adapter->fw_version, lbuf, sizeof(adapter->fw_version));
|
||||
kfree(lbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,11 +130,7 @@ void igc_power_down_phy_copper(struct igc_hw *hw)
|
||||
/* The PHY will retain its settings across a power down/up cycle */
|
||||
hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg);
|
||||
mii_reg |= MII_CR_POWER_DOWN;
|
||||
|
||||
/* Temporary workaround - should be removed when PHY will implement
|
||||
* IEEE registers as properly
|
||||
*/
|
||||
/* hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);*/
|
||||
hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);
|
||||
usleep_range(1000, 2000);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user