Re: [PATCH 1/4] e1000: drop checksum constant cast to u16 in comparisons
From: Simon Horman
Date: Wed Jun 25 2025 - 08:19:47 EST
On Wed, Jun 25, 2025 at 01:18:28PM +0100, Simon Horman wrote:
> On Tue, Jun 24, 2025 at 09:29:43PM +0200, Jacek Kowalski wrote:
>
> Hi Jacek,
>
> Thanks for the patchset.
>
> Some feedback at a high level:
>
> 1. It's normal for patch-sets, to have a cover letter.
> That provides a handy place for high level comments,
> perhaps ironically, such as this one.
>
> 2. Please provide some text in the patch description.
> I know these changes are trivial. But we'd like to have something there.
> E.g.
>
> Remove unnecessary cast of constants to u16,
> allowing the C type system to do it's thing.
>
> No behavioural change intended.
> Compile tested only.
>
> 3. This patchset should probably be targeted at iwl-next, like this:
>
> Subject: [PATCH iwl-next] ...
>
> 4. Please make sure the patchset applies cleanly to it's target tree.
> It seems that in it's current form the patchset doesn't
> apply to iwl-next or net-next.
>
> 5. It's up to you. But in general there is no need
> to CC linux-kernel@xxxxxxxxxxxxxxx on Networking patches
>
> > Signed-off-by: Jacek Kowalski <Jacek@xxxxxxxxxxx>
> > Suggested-by: Simon Horman <horms@xxxxxxxxxx>
>
> As for this patch itself, it looks good to me.
> But I think you missed two.
>
> diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c
> index b5a31e8d84f4..0e5de52b1067 100644
> --- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
> +++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
> @@ -3997,7 +3997,7 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
> }
> checksum += eeprom_data;
> }
> - checksum = (u16)EEPROM_SUM - checksum;
> + checksum = EEPROM_SUM - checksum;
> if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) {
> e_dbg("EEPROM Write Error\n");
> return -E1000_ERR_EEPROM;
> diff --git a/drivers/net/ethernet/intel/e1000e/nvm.c b/drivers/net/ethernet/intel/e1000e/nvm.c
> index 1c9071396b3c..556dbefdcef9 100644
> --- a/drivers/net/ethernet/intel/e1000e/nvm.c
> +++ b/drivers/net/ethernet/intel/e1000e/nvm.c
> @@ -588,7 +588,7 @@ s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
> }
> checksum += nvm_data;
> }
> - checksum = (u16)NVM_SUM - checksum;
> + checksum = NVM_SUM - checksum;
> ret_val = e1000_write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
> if (ret_val)
> e_dbg("NVM Write Error while updating checksum.\n");
Sorry, I now see that the 2nd of the two hunks above is for patch 2/4.