diff mbox series

[-next] IB/hfi1: Use free_netdev() in hfi1_netdev_free()

Message ID 20200602061635.31224-1-yuehaibing@huawei.com (mailing list archive)
State Mainlined
Commit 193ba03141bb987c3af985f6479840030fec0534
Delegated to: Jason Gunthorpe
Headers show
Series [-next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() | expand

Commit Message

Yue Haibing June 2, 2020, 6:16 a.m. UTC
dummy_netdev shold be freed by free_netdev() instead of
kfree(). Also remove unneeded variable 'priv'

Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/infiniband/hw/hfi1/netdev_rx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Dennis Dalessandro June 2, 2020, 3:30 p.m. UTC | #1
On 6/2/2020 2:16 AM, YueHaibing wrote:
> dummy_netdev shold be freed by free_netdev() instead of
> kfree(). Also remove unneeded variable 'priv'
> 
> Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/infiniband/hw/hfi1/netdev_rx.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c
> index 58af6a454761..63688e85e8da 100644
> --- a/drivers/infiniband/hw/hfi1/netdev_rx.c
> +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
> @@ -371,12 +371,9 @@ int hfi1_netdev_alloc(struct hfi1_devdata *dd)
>   
>   void hfi1_netdev_free(struct hfi1_devdata *dd)
>   {
> -	struct hfi1_netdev_priv *priv;
> -
>   	if (dd->dummy_netdev) {
> -		priv = hfi1_netdev_priv(dd->dummy_netdev);
>   		dd_dev_info(dd, "hfi1 netdev freed\n");
> -		kfree(dd->dummy_netdev);
> +		free_netdev(dd->dummy_netdev);
>   		dd->dummy_netdev = NULL;
>   	}
>   }
> 

For the kfree->free_netdev, you probably want to add:
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Also can add:
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>

Thanks
Dan Carpenter June 2, 2020, 6:38 p.m. UTC | #2
On Tue, Jun 02, 2020 at 11:30:13AM -0400, Dennis Dalessandro wrote:
> On 6/2/2020 2:16 AM, YueHaibing wrote:
> > dummy_netdev shold be freed by free_netdev() instead of
> > kfree(). Also remove unneeded variable 'priv'
> > 
> > Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> >   drivers/infiniband/hw/hfi1/netdev_rx.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c
> > index 58af6a454761..63688e85e8da 100644
> > --- a/drivers/infiniband/hw/hfi1/netdev_rx.c
> > +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
> > @@ -371,12 +371,9 @@ int hfi1_netdev_alloc(struct hfi1_devdata *dd)
> >   void hfi1_netdev_free(struct hfi1_devdata *dd)
> >   {
> > -	struct hfi1_netdev_priv *priv;
> > -
> >   	if (dd->dummy_netdev) {
> > -		priv = hfi1_netdev_priv(dd->dummy_netdev);
> >   		dd_dev_info(dd, "hfi1 netdev freed\n");
> > -		kfree(dd->dummy_netdev);
> > +		free_netdev(dd->dummy_netdev);
> >   		dd->dummy_netdev = NULL;
> >   	}
> >   }
> > 
> 
> For the kfree->free_netdev, you probably want to add:
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

YueHaibing wasn't on the CC list when I sent forwarded that kbuild bot
email.  Forget about it.  Let's just apply this.

regards,
dan carpenter
Jason Gunthorpe June 3, 2020, 12:36 a.m. UTC | #3
On Tue, Jun 02, 2020 at 02:16:35PM +0800, YueHaibing wrote:
> dummy_netdev shold be freed by free_netdev() instead of
> kfree(). Also remove unneeded variable 'priv'
> 
> Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> ---
>  drivers/infiniband/hw/hfi1/netdev_rx.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c
index 58af6a454761..63688e85e8da 100644
--- a/drivers/infiniband/hw/hfi1/netdev_rx.c
+++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
@@ -371,12 +371,9 @@  int hfi1_netdev_alloc(struct hfi1_devdata *dd)
 
 void hfi1_netdev_free(struct hfi1_devdata *dd)
 {
-	struct hfi1_netdev_priv *priv;
-
 	if (dd->dummy_netdev) {
-		priv = hfi1_netdev_priv(dd->dummy_netdev);
 		dd_dev_info(dd, "hfi1 netdev freed\n");
-		kfree(dd->dummy_netdev);
+		free_netdev(dd->dummy_netdev);
 		dd->dummy_netdev = NULL;
 	}
 }