aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Tanure <[email protected]>2020-02-29 17:30:07 +0000
committerWei Liu <[email protected]>2020-03-05 14:17:11 +0000
commit5313b2a58ef02e2b077d7ae8088043609e3155b0 (patch)
tree025a48bb932ac5401042b5ac44e28b06c75f9db9
parent8c1b0767ae0c4b18cd967556aa6ddc7aab5bef0d (diff)
HID: hyperv: NULL check before some freeing functions is not needed.
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 <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Reviewed-by: Wei Liu <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Signed-off-by: Wei Liu <[email protected]>
-rw-r--r--drivers/hid/hid-hyperv.c6
1 files 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);