Message ID | 20200911012337.14015-1-jesse.brandeburg@intel.com |
---|---|
Headers | show |
Series | make drivers/net/ethernet W=1 clean | expand |
On Thu, 10 Sep 2020 18:23:26 -0700 Jesse Brandeburg wrote: > This series is a placeholder to show I've about finished this work. > > After applying the patches below, the drivers/net/ethernet > directory can be built as modules with W=1 with no warnings. > > This series removes 1,283 warnings and hopefully allows the ethernet > directory to move forward from here without more warnings being added. > > Some of these patches are already sent to Intel Wired Lan, but the rest > of the series titled drivers/net/ethernet affects other drivers, not > just Intel, but they depend on the first five. Great stuff. Much easier to apply one large series than a thousand small patches. I haven't read all the comment changes but FWIW: Reviewed-by: Jakub Kicinski <kuba@kernel.org> I feel slightly bad for saying this but I think your config did not include all the drivers, 'cause I'm still getting some warnings after patch 11. Regardless this is impressive effort, thanks!
On 11/09/2020 02:23, Jesse Brandeburg wrote: > As part of the W=1 compliation series, these lines all created > warnings about unused variables that were assigned a value. Most > of them are from register reads, but some are just picking up > a return value from a function and never doing anything with it. > > The register reads should be OK, because the current > implementation of readl and friends will always execute even > without an lvalue. > > When it makes sense, just remove the lvalue assignment and the > local. Other times, just remove the offending code, and > occasionally, just mark the variable as maybe unused since it > could be used in an ifdef or debug scenario. > > Only compile tested with W=1 and an allyesconfig with all the > network drivers turned into modules (to try to test all options). > > Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> For the sfc/falcon part: Acked-by: Edward Cree <ecree@solarflare.com> (it's not the same as the solution I went with for thevery similar code in the Siena driver (../farch.c), but it looks reasonable enough).
Jesse Brandeburg <jesse.brandeburg@intel.com> writes: > This takes care of all of the trivial W=1 fixes in the Intel > Ethernet drivers, which allows developers and maintainers to > build more of the networking tree with more complete warning > checks. > > Almost all of the changes were trivial comment updates on > function headers, but some of the changes were for variables that > were storing a return value from a register read, where the > return value wasn't used. Those conversions to remove the lvalue > of the assignment should be safe because the readl memory mapped > reads are marked volatile and should not be optimized out without > an lvalue (I suspect a very long time ago this wasn't guaranteed > as it is today). > > Inspired by Lee Jones' series of wireless work to do the same. > Compile tested only. > > Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> > --- > drivers/net/ethernet/intel/e100.c | 8 +- > drivers/net/ethernet/intel/e1000/e1000_hw.c | 147 ++++++++---------- > drivers/net/ethernet/intel/e1000/e1000_main.c | 39 +++-- > .../net/ethernet/intel/e1000e/80003es2lan.c | 1 - > drivers/net/ethernet/intel/e1000e/ich8lan.c | 16 +- > drivers/net/ethernet/intel/e1000e/netdev.c | 50 ++++-- > drivers/net/ethernet/intel/e1000e/phy.c | 3 + > drivers/net/ethernet/intel/e1000e/ptp.c | 2 +- > drivers/net/ethernet/intel/igb/e1000_82575.c | 6 +- > drivers/net/ethernet/intel/igb/e1000_i210.c | 5 +- > drivers/net/ethernet/intel/igb/e1000_mac.c | 1 + > drivers/net/ethernet/intel/igb/e1000_mbx.c | 1 + > drivers/net/ethernet/intel/igb/igb_main.c | 28 ++-- > drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +- > drivers/net/ethernet/intel/igbvf/netdev.c | 17 +- > drivers/net/ethernet/intel/igc/igc_main.c | 2 +- > drivers/net/ethernet/intel/igc/igc_ptp.c | 4 +- > drivers/net/ethernet/intel/ixgb/ixgb_hw.c | 135 ++++++++-------- > drivers/net/ethernet/intel/ixgb/ixgb_main.c | 17 +- > .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 +- > 20 files changed, 265 insertions(+), 228 deletions(-) > ... > diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c > index 4e7a0810eaeb..2120dacfd55c 100644 > --- a/drivers/net/ethernet/intel/e1000/e1000_hw.c > +++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c > @@ -139,6 +139,7 @@ static void e1000_phy_init_script(struct e1000_hw *hw) > * at the end of this routine. > */ > ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); > + e_dbg("Reading PHY register 0x2F5B failed: %d\n", ret_val); > Adding this debug statement seems unrelated. > /* Disabled the PHY transmitter */ > e1000_write_phy_reg(hw, 0x2F5B, 0x0003); Apart from this, Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
On Fri, Sep 11, 2020 at 02:34:05PM -0700, Jesse Brandeburg wrote: > Here is a list of driver files with sparse warnings from C=1, maybe we > can encourage some others to help me fix them? I can take care of drivers/net/ethernet/freescale, thanks for the effort so far! I'll try to send a patch tomorrow. -Vladimir
Vinicius Costa Gomes wrote: > > diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c > > index 4e7a0810eaeb..2120dacfd55c 100644 > > --- a/drivers/net/ethernet/intel/e1000/e1000_hw.c > > +++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c > > @@ -139,6 +139,7 @@ static void e1000_phy_init_script(struct e1000_hw *hw) > > * at the end of this routine. > > */ > > ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); > > + e_dbg("Reading PHY register 0x2F5B failed: %d\n", ret_val); > > > > Adding this debug statement seems unrelated. Thanks, in the next version I actually addressed this in the commit message, that this one change was to solve the "you didn't use ret_val" with a conceivably useful message. I also rejiggered the patches to have the register read lvalue removals all in their own patch instead of squashed together with kdoc changes. > > > /* Disabled the PHY transmitter */ > > e1000_write_phy_reg(hw, 0x2F5B, 0x0003); > > Apart from this, > > Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> > Thanks for the review!