linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
@ 2020-02-29 17:30 Lucas Tanure
  2020-02-29 20:20 ` Michael Kelley
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Lucas Tanure @ 2020-02-29 17:30 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Sasha Levin,
	Jiri Kosina, Benjamin Tissoires, linux-hyperv, linux-input,
	linux-kernel
  Cc: Lucas Tanure

Fix below warnings reported by coccicheck:
drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/hid/hid-hyperv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index dddfca555df9..0b6ee1dee625 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -193,8 +193,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
 		goto cleanup;
 
 	/* The pointer is not NULL when we resume from hibernation */
-	if (input_device->hid_desc != NULL)
-		kfree(input_device->hid_desc);
+	kfree(input_device->hid_desc);
 	input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
 
 	if (!input_device->hid_desc)
@@ -207,8 +206,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
 	}
 
 	/* The pointer is not NULL when we resume from hibernation */
-	if (input_device->report_desc != NULL)
-		kfree(input_device->report_desc);
+	kfree(input_device->report_desc);
 	input_device->report_desc = kzalloc(input_device->report_desc_size,
 					  GFP_ATOMIC);
 
-- 
2.25.1


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

* RE: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-02-29 17:30 [PATCH] HID: hyperv: NULL check before some freeing functions is not needed Lucas Tanure
@ 2020-02-29 20:20 ` Michael Kelley
  2020-02-29 22:48 ` Wei Liu
  2020-03-02 10:16 ` Benjamin Tissoires
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Kelley @ 2020-02-29 20:20 UTC (permalink / raw)
  To: Lucas Tanure, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Jiri Kosina, Benjamin Tissoires, linux-hyperv,
	linux-input, linux-kernel

From: Lucas Tanure <tanure@linux.com> Sent: Saturday, February 29, 2020 9:30 AM
> 
> Fix below warnings reported by coccicheck:
> drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is
> not needed.
> drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is
> not needed.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>

Reviewed-by: Michael Kelley <mikelley@microsoft.com>

> ---
>  drivers/hid/hid-hyperv.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> index dddfca555df9..0b6ee1dee625 100644
> --- a/drivers/hid/hid-hyperv.c
> +++ b/drivers/hid/hid-hyperv.c
> @@ -193,8 +193,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev
> *input_device,
>  		goto cleanup;
> 
>  	/* The pointer is not NULL when we resume from hibernation */
> -	if (input_device->hid_desc != NULL)
> -		kfree(input_device->hid_desc);
> +	kfree(input_device->hid_desc);
>  	input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
> 
>  	if (!input_device->hid_desc)
> @@ -207,8 +206,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev
> *input_device,
>  	}
> 
>  	/* The pointer is not NULL when we resume from hibernation */
> -	if (input_device->report_desc != NULL)
> -		kfree(input_device->report_desc);
> +	kfree(input_device->report_desc);
>  	input_device->report_desc = kzalloc(input_device->report_desc_size,
>  					  GFP_ATOMIC);
> 
> --
> 2.25.1


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

* Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-02-29 17:30 [PATCH] HID: hyperv: NULL check before some freeing functions is not needed Lucas Tanure
  2020-02-29 20:20 ` Michael Kelley
@ 2020-02-29 22:48 ` Wei Liu
  2020-03-02 10:16 ` Benjamin Tissoires
  2 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2020-02-29 22:48 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Sasha Levin,
	Jiri Kosina, Benjamin Tissoires, linux-hyperv, linux-input,
	linux-kernel, Wei Liu

On Sat, Feb 29, 2020 at 05:30:07PM +0000, Lucas Tanure wrote:
> Fix below warnings reported by coccicheck:
> drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
> drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>

Reviewed-by: Wei Liu <wei.liu@kernel.org>

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

* Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-02-29 17:30 [PATCH] HID: hyperv: NULL check before some freeing functions is not needed Lucas Tanure
  2020-02-29 20:20 ` Michael Kelley
  2020-02-29 22:48 ` Wei Liu
@ 2020-03-02 10:16 ` Benjamin Tissoires
  2020-03-02 12:09   ` Wei Liu
  2 siblings, 1 reply; 7+ messages in thread
From: Benjamin Tissoires @ 2020-03-02 10:16 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Sasha Levin,
	Jiri Kosina, linux-hyperv, open list:HID CORE LAYER, lkml

On Sat, Feb 29, 2020 at 6:30 PM Lucas Tanure <tanure@linux.com> wrote:
>
> Fix below warnings reported by coccicheck:
> drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
> drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
>
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---

Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Sasha, do you prefer taking this through your tree or through the HID
one. I don't think we have much scheduled for hyperv, so it's up to
you.

Cheers,
Benjamin

>  drivers/hid/hid-hyperv.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> index dddfca555df9..0b6ee1dee625 100644
> --- a/drivers/hid/hid-hyperv.c
> +++ b/drivers/hid/hid-hyperv.c
> @@ -193,8 +193,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
>                 goto cleanup;
>
>         /* The pointer is not NULL when we resume from hibernation */
> -       if (input_device->hid_desc != NULL)
> -               kfree(input_device->hid_desc);
> +       kfree(input_device->hid_desc);
>         input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
>
>         if (!input_device->hid_desc)
> @@ -207,8 +206,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
>         }
>
>         /* The pointer is not NULL when we resume from hibernation */
> -       if (input_device->report_desc != NULL)
> -               kfree(input_device->report_desc);
> +       kfree(input_device->report_desc);
>         input_device->report_desc = kzalloc(input_device->report_desc_size,
>                                           GFP_ATOMIC);
>
> --
> 2.25.1
>


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

* Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-03-02 10:16 ` Benjamin Tissoires
@ 2020-03-02 12:09   ` Wei Liu
  2020-03-04 14:48     ` Wei Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2020-03-02 12:09 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Lucas Tanure, K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Jiri Kosina, linux-hyperv, open list:HID CORE LAYER,
	lkml, Wei Liu

Hi Benjamin

On Mon, Mar 02, 2020 at 11:16:30AM +0100, Benjamin Tissoires wrote:
> On Sat, Feb 29, 2020 at 6:30 PM Lucas Tanure <tanure@linux.com> wrote:
> >
> > Fix below warnings reported by coccicheck:
> > drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
> > drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
> >
> > Signed-off-by: Lucas Tanure <tanure@linux.com>
> > ---
> 
> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> 
> Sasha, do you prefer taking this through your tree or through the HID
> one. I don't think we have much scheduled for hyperv, so it's up to
> you.

Sasha stepped down as a hyperv maintainer a few days back. I will be
taking over maintenance of the hyperv tree.

The problem is at the moment I haven't got write access to the
repository hosted on git.kernel.org. That's something I will need to
sort out as soon as possible.

In the meantime, it would be great if you can pick up this patch so that
it doesn't get lost while I sort out access on my side.

Thanks,
Wei.

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

* Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-03-02 12:09   ` Wei Liu
@ 2020-03-04 14:48     ` Wei Liu
  2020-03-04 14:55       ` Benjamin Tissoires
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2020-03-04 14:48 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Lucas Tanure, K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Jiri Kosina, linux-hyperv, open list:HID CORE LAYER,
	lkml, Wei Liu

On Mon, Mar 02, 2020 at 12:09:51PM +0000, Wei Liu wrote:
> Hi Benjamin
> 
> On Mon, Mar 02, 2020 at 11:16:30AM +0100, Benjamin Tissoires wrote:
> > On Sat, Feb 29, 2020 at 6:30 PM Lucas Tanure <tanure@linux.com> wrote:
> > >
> > > Fix below warnings reported by coccicheck:
> > > drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
> > > drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
> > >
> > > Signed-off-by: Lucas Tanure <tanure@linux.com>
> > > ---
> > 
> > Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > 
> > Sasha, do you prefer taking this through your tree or through the HID
> > one. I don't think we have much scheduled for hyperv, so it's up to
> > you.
> 
> Sasha stepped down as a hyperv maintainer a few days back. I will be
> taking over maintenance of the hyperv tree.
> 
> The problem is at the moment I haven't got write access to the
> repository hosted on git.kernel.org. That's something I will need to
> sort out as soon as possible.
> 
> In the meantime, it would be great if you can pick up this patch so that
> it doesn't get lost while I sort out access on my side.

Hi Benjamin

I got access to the Hyper-V tree. I will be picking this patch up since
I haven't got a confirmation from your side.

Wei.

> 
> Thanks,
> Wei.

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

* Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed.
  2020-03-04 14:48     ` Wei Liu
@ 2020-03-04 14:55       ` Benjamin Tissoires
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Tissoires @ 2020-03-04 14:55 UTC (permalink / raw)
  To: Wei Liu
  Cc: Lucas Tanure, K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Jiri Kosina, linux-hyperv, open list:HID CORE LAYER,
	lkml

On Wed, Mar 4, 2020 at 3:49 PM Wei Liu <wei.liu@kernel.org> wrote:
>
> On Mon, Mar 02, 2020 at 12:09:51PM +0000, Wei Liu wrote:
> > Hi Benjamin
> >
> > On Mon, Mar 02, 2020 at 11:16:30AM +0100, Benjamin Tissoires wrote:
> > > On Sat, Feb 29, 2020 at 6:30 PM Lucas Tanure <tanure@linux.com> wrote:
> > > >
> > > > Fix below warnings reported by coccicheck:
> > > > drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
> > > > drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
> > > >
> > > > Signed-off-by: Lucas Tanure <tanure@linux.com>
> > > > ---
> > >
> > > Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > >
> > > Sasha, do you prefer taking this through your tree or through the HID
> > > one. I don't think we have much scheduled for hyperv, so it's up to
> > > you.
> >
> > Sasha stepped down as a hyperv maintainer a few days back. I will be
> > taking over maintenance of the hyperv tree.
> >
> > The problem is at the moment I haven't got write access to the
> > repository hosted on git.kernel.org. That's something I will need to
> > sort out as soon as possible.
> >
> > In the meantime, it would be great if you can pick up this patch so that
> > it doesn't get lost while I sort out access on my side.
>
> Hi Benjamin
>
> I got access to the Hyper-V tree. I will be picking this patch up since
> I haven't got a confirmation from your side.
>

Great, thanks.

Sorry, I am pulled in freedesktop tasks right now that are a little bit urgent.

Glad you quickly set up the access rights.

Cheers,
Benjamin


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

end of thread, other threads:[~2020-03-04 14:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-29 17:30 [PATCH] HID: hyperv: NULL check before some freeing functions is not needed Lucas Tanure
2020-02-29 20:20 ` Michael Kelley
2020-02-29 22:48 ` Wei Liu
2020-03-02 10:16 ` Benjamin Tissoires
2020-03-02 12:09   ` Wei Liu
2020-03-04 14:48     ` Wei Liu
2020-03-04 14:55       ` Benjamin Tissoires

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).