Message ID | 20220616045259.1130087-1-william.xuanziyang@huawei.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] ice: Remove unnecessary NULL check before dev_put | expand |
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Ziyang Xuan > Sent: Thursday, June 16, 2022 10:23 AM > To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; davem@davemloft.net; > edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; intel- > wired-lan@lists.osuosl.org; netdev@vger.kernel.org > Subject: [Intel-wired-lan] [PATCH net-next] ice: Remove unnecessary NULL > check before dev_put > > Since commit b37a46683739 ("netdevice: add the case if dev is NULL"), > dev_put(NULL) is safe, check NULL before dev_put() is not needed. > > Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> > --- > drivers/net/ethernet/intel/ice/ice_lag.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c index 4f954db01b92..c9f7393b783d 100644 --- a/drivers/net/ethernet/intel/ice/ice_lag.c +++ b/drivers/net/ethernet/intel/ice/ice_lag.c @@ -447,11 +447,9 @@ void ice_deinit_lag(struct ice_pf *pf) if (lag->pf) ice_unregister_lag_handler(lag); - if (lag->upper_netdev) - dev_put(lag->upper_netdev); + dev_put(lag->upper_netdev); - if (lag->peer_netdev) - dev_put(lag->peer_netdev); + dev_put(lag->peer_netdev); kfree(lag);
Since commit b37a46683739 ("netdevice: add the case if dev is NULL"), dev_put(NULL) is safe, check NULL before dev_put() is not needed. Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> --- drivers/net/ethernet/intel/ice/ice_lag.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)