[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR2101MB10472B84AF391205091D03B1D7E90@DM5PR2101MB1047.namprd21.prod.outlook.com>
Date: Sat, 29 Feb 2020 20:20:07 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: Lucas Tanure <tanure@...ux.com>, KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Sasha Levin <sashal@...nel.org>,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] HID: hyperv: NULL check before some freeing functions is
not needed.
From: Lucas Tanure <tanure@...ux.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@...ux.com>
Reviewed-by: Michael Kelley <mikelley@...rosoft.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
Powered by blists - more mailing lists