Message ID | a6f3f931-17eb-4e53-9220-f81e7b311a8c@ancud.ru (mailing list archive) |
---|---|
State | Deferred |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2] tg3: Remove residual error handling in tg3_suspend | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
On Mon, Mar 11, 2024 at 8:45 AM Nikita Kiryushin <kiryushin@ancud.ru> wrote: > > > As of now, tg3_power_down_prepare always ends with success, but > the error handling code from former tg3_set_power_state call is still here. > > Remove (now unreachable) code for simplification and change > tg3_power_down_prepare to a void function as its result is no more checked. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: c866b7eac073 ("tg3: Do not use legacy PCI power management") > Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru> > --- > v2: Change tg3_power_down_prepare() to a void function > as Michael Chan <michael.chan@broadcom.com> suggested. > drivers/net/ethernet/broadcom/tg3.c | 30 ++++------------------------- > 1 file changed, 4 insertions(+), 26 deletions(-) The patch looks good to me. But this cleanup patch should be for net-next and net-next is closed right now. Please re-post in about 2 weeks. You can add my tag when you repost: Reviewed-by: Michael Chan <michael.chan@broadcom.com> Thanks.
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 04964bbe08cf..bc36926a57cf 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -4019,7 +4019,7 @@ static int tg3_power_up(struct tg3 *tp) static int tg3_setup_phy(struct tg3 *, bool); -static int tg3_power_down_prepare(struct tg3 *tp) +static void tg3_power_down_prepare(struct tg3 *tp) { u32 misc_host_ctrl; bool device_should_wake, do_low_power; @@ -4263,7 +4263,7 @@ static int tg3_power_down_prepare(struct tg3 *tp) tg3_ape_driver_state_change(tp, RESET_KIND_SHUTDOWN);
As of now, tg3_power_down_prepare always ends with success, but the error handling code from former tg3_set_power_state call is still here. Remove (now unreachable) code for simplification and change tg3_power_down_prepare to a void function as its result is no more checked. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c866b7eac073 ("tg3: Do not use legacy PCI power management") Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru> --- v2: Change tg3_power_down_prepare() to a void function as Michael Chan <michael.chan@broadcom.com> suggested. drivers/net/ethernet/broadcom/tg3.c | 30 ++++------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) - return 0; + return; } static void tg3_power_down(struct tg3 *tp) @@ -18090,7 +18090,6 @@ static int tg3_suspend(struct device *device) { struct net_device *dev = dev_get_drvdata(device); struct tg3 *tp = netdev_priv(dev); - int err = 0; rtnl_lock(); @@ -18114,32 +18113,11 @@ static int tg3_suspend(struct device *device) tg3_flag_clear(tp, INIT_COMPLETE); tg3_full_unlock(tp); - err = tg3_power_down_prepare(tp); - if (err) { - int err2; - - tg3_full_lock(tp, 0); - - tg3_flag_set(tp, INIT_COMPLETE); - err2 = tg3_restart_hw(tp, true); - if (err2) - goto out; - - tg3_timer_start(tp); - - netif_device_attach(dev); - tg3_netif_start(tp); - -out: - tg3_full_unlock(tp); - - if (!err2) - tg3_phy_start(tp); - } + tg3_power_down_prepare(tp); unlock: rtnl_unlock(); - return err; + return 0; } static int tg3_resume(struct device *device)