linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] IB/hfi1: Remove set but not used variable 'priv'
@ 2020-05-28  7:59 YueHaibing
  2020-05-28 11:25 ` Marciniszyn, Mike
  0 siblings, 1 reply; 9+ messages in thread
From: YueHaibing @ 2020-05-28  7:59 UTC (permalink / raw)
  To: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford, Jason Gunthorpe
  Cc: YueHaibing, linux-rdma, kernel-janitors

drivers/infiniband/hw/hfi1/netdev_rx.c: In function 'hfi1_netdev_free':
drivers/infiniband/hw/hfi1/netdev_rx.c:374:27: warning:
 variable 'priv' set but not used [-Wunused-but-set-variable]

It is never used, so can be removed, then null check before
kfree is unneeded.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/infiniband/hw/hfi1/netdev_rx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c
index 58af6a454761..bd6546b52159 100644
--- a/drivers/infiniband/hw/hfi1/netdev_rx.c
+++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
@@ -371,14 +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);
-		dd->dummy_netdev = NULL;
-	}
+	dd_dev_info(dd, "hfi1 netdev freed\n");
+	kfree(dd->dummy_netdev);
+	dd->dummy_netdev = NULL;
 }
 
 /**




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH -next] IB/hfi1: Remove set but not used variable 'priv'
  2020-05-28  7:59 [PATCH -next] IB/hfi1: Remove set but not used variable 'priv' YueHaibing
@ 2020-05-28 11:25 ` Marciniszyn, Mike
  2020-06-01 13:45   ` Dennis Dalessandro
  0 siblings, 1 reply; 9+ messages in thread
From: Marciniszyn, Mike @ 2020-05-28 11:25 UTC (permalink / raw)
  To: YueHaibing, Dalessandro, Dennis, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, kernel-janitors, Dan Carpenter (dan.carpenter@oracle.com)

> From: YueHaibing <yuehaibing@huawei.com>
> Sent: Thursday, May 28, 2020 4:00 AM
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/infiniband/hw/hfi1/netdev_rx.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c
> b/drivers/infiniband/hw/hfi1/netdev_rx.c
> index 58af6a454761..bd6546b52159 100644
> --- a/drivers/infiniband/hw/hfi1/netdev_rx.c
> +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
> @@ -371,14 +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);
> -		dd->dummy_netdev = NULL;
> -	}
> +	dd_dev_info(dd, "hfi1 netdev freed\n");
> +	kfree(dd->dummy_netdev);

Dan Carpenter has reported kfree() should be free_netdev()...

Mike

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Remove set but not used variable 'priv'
  2020-05-28 11:25 ` Marciniszyn, Mike
@ 2020-06-01 13:45   ` Dennis Dalessandro
  2020-06-01 13:56     ` Jason Gunthorpe
  0 siblings, 1 reply; 9+ messages in thread
From: Dennis Dalessandro @ 2020-06-01 13:45 UTC (permalink / raw)
  To: Marciniszyn, Mike, YueHaibing, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, kernel-janitors, Dan Carpenter (dan.carpenter@oracle.com)

On 5/28/2020 7:25 AM, Marciniszyn, Mike wrote:
>> From: YueHaibing <yuehaibing@huawei.com>
>> Sent: Thursday, May 28, 2020 4:00 AM
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>   drivers/infiniband/hw/hfi1/netdev_rx.c | 11 +++--------
>>   1 file changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c
>> b/drivers/infiniband/hw/hfi1/netdev_rx.c
>> index 58af6a454761..bd6546b52159 100644
>> --- a/drivers/infiniband/hw/hfi1/netdev_rx.c
>> +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
>> @@ -371,14 +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);
>> -dd->dummy_netdev = NULL;
>> -}
>> +dd_dev_info(dd, "hfi1 netdev freed\n");
>> +kfree(dd->dummy_netdev);
> 
> Dan Carpenter has reported kfree() should be free_netdev()...
> 
> Mike
> 

I'm OK with this patch going in and then adding a separate one to fix 
the kfree. Or this one can be touched up to include that as well.

-Denny


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Remove set but not used variable 'priv'
  2020-06-01 13:45   ` Dennis Dalessandro
@ 2020-06-01 13:56     ` Jason Gunthorpe
  2020-06-02  0:59       ` Yuehaibing
  2020-06-02  6:16       ` [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() YueHaibing
  0 siblings, 2 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2020-06-01 13:56 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: Marciniszyn, Mike, YueHaibing, Doug Ledford, linux-rdma,
	kernel-janitors, Dan Carpenter (dan.carpenter@oracle.com)

On Mon, Jun 01, 2020 at 09:45:52AM -0400, Dennis Dalessandro wrote:
> On 5/28/2020 7:25 AM, Marciniszyn, Mike wrote:
> > > From: YueHaibing <yuehaibing@huawei.com>
> > > Sent: Thursday, May 28, 2020 4:00 AM
> > > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > >   drivers/infiniband/hw/hfi1/netdev_rx.c | 11 +++--------
> > >   1 file changed, 3 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c
> > > b/drivers/infiniband/hw/hfi1/netdev_rx.c
> > > index 58af6a454761..bd6546b52159 100644
> > > +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
> > > @@ -371,14 +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);
> > > -dd->dummy_netdev = NULL;
> > > -}
> > > +dd_dev_info(dd, "hfi1 netdev freed\n");
> > > +kfree(dd->dummy_netdev);
> > 
> > Dan Carpenter has reported kfree() should be free_netdev()...
> > 
> > Mike
> > 
> 
> I'm OK with this patch going in and then adding a separate one to fix the
> kfree. Or this one can be touched up to include that as well.

Please resend it with both things fixed

Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Remove set but not used variable 'priv'
  2020-06-01 13:56     ` Jason Gunthorpe
@ 2020-06-02  0:59       ` Yuehaibing
  2020-06-02  6:16       ` [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() YueHaibing
  1 sibling, 0 replies; 9+ messages in thread
From: Yuehaibing @ 2020-06-02  0:59 UTC (permalink / raw)
  To: Jason Gunthorpe, Dennis Dalessandro
  Cc: Marciniszyn, Mike, Doug Ledford, linux-rdma, kernel-janitors,
	Dan Carpenter (dan.carpenter@oracle.com)

On 2020/6/1 21:56, Jason Gunthorpe wrote:
> On Mon, Jun 01, 2020 at 09:45:52AM -0400, Dennis Dalessandro wrote:
>> On 5/28/2020 7:25 AM, Marciniszyn, Mike wrote:
>>>> From: YueHaibing <yuehaibing@huawei.com>
>>>> Sent: Thursday, May 28, 2020 4:00 AM
>>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>>>   drivers/infiniband/hw/hfi1/netdev_rx.c | 11 +++--------
>>>>   1 file changed, 3 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c
>>>> b/drivers/infiniband/hw/hfi1/netdev_rx.c
>>>> index 58af6a454761..bd6546b52159 100644
>>>> +++ b/drivers/infiniband/hw/hfi1/netdev_rx.c
>>>> @@ -371,14 +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);
>>>> -dd->dummy_netdev = NULL;
>>>> -}
>>>> +dd_dev_info(dd, "hfi1 netdev freed\n");
>>>> +kfree(dd->dummy_netdev);
>>>
>>> Dan Carpenter has reported kfree() should be free_netdev()...
>>>
>>> Mike
>>>
>>
>> I'm OK with this patch going in and then adding a separate one to fix the
>> kfree. Or this one can be touched up to include that as well.
> 
> Please resend it with both things fixed

Ok, will do that in v2.
> 
> Jason
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free()
  2020-06-01 13:56     ` Jason Gunthorpe
  2020-06-02  0:59       ` Yuehaibing
@ 2020-06-02  6:16       ` YueHaibing
  2020-06-02 15:30         ` Dennis Dalessandro
  2020-06-03  0:36         ` Jason Gunthorpe
  1 sibling, 2 replies; 9+ messages in thread
From: YueHaibing @ 2020-06-02  6:16 UTC (permalink / raw)
  To: mike.marciniszyn, dennis.dalessandro, dledford, jgg,
	sadanand.warrier, grzegorz.andrejczuk, yuehaibing
  Cc: linux-rdma, linux-kernel, dan.carpenter, kernel-janitors

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;
 	}
 }
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free()
  2020-06-02  6:16       ` [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() YueHaibing
@ 2020-06-02 15:30         ` Dennis Dalessandro
  2020-06-02 18:38           ` Dan Carpenter
  2020-06-03  0:36         ` Jason Gunthorpe
  1 sibling, 1 reply; 9+ messages in thread
From: Dennis Dalessandro @ 2020-06-02 15:30 UTC (permalink / raw)
  To: YueHaibing, mike.marciniszyn, dledford, jgg, sadanand.warrier,
	grzegorz.andrejczuk
  Cc: linux-rdma, linux-kernel, dan.carpenter, kernel-janitors

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free()
  2020-06-02 15:30         ` Dennis Dalessandro
@ 2020-06-02 18:38           ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2020-06-02 18:38 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: YueHaibing, mike.marciniszyn, dledford, jgg, sadanand.warrier,
	grzegorz.andrejczuk, linux-rdma, linux-kernel, kernel-janitors

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free()
  2020-06-02  6:16       ` [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() YueHaibing
  2020-06-02 15:30         ` Dennis Dalessandro
@ 2020-06-03  0:36         ` Jason Gunthorpe
  1 sibling, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2020-06-03  0:36 UTC (permalink / raw)
  To: YueHaibing
  Cc: mike.marciniszyn, dennis.dalessandro, dledford, sadanand.warrier,
	grzegorz.andrejczuk, linux-rdma, linux-kernel, dan.carpenter,
	kernel-janitors

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-03  0:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28  7:59 [PATCH -next] IB/hfi1: Remove set but not used variable 'priv' YueHaibing
2020-05-28 11:25 ` Marciniszyn, Mike
2020-06-01 13:45   ` Dennis Dalessandro
2020-06-01 13:56     ` Jason Gunthorpe
2020-06-02  0:59       ` Yuehaibing
2020-06-02  6:16       ` [PATCH -next] IB/hfi1: Use free_netdev() in hfi1_netdev_free() YueHaibing
2020-06-02 15:30         ` Dennis Dalessandro
2020-06-02 18:38           ` Dan Carpenter
2020-06-03  0:36         ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).