Skip to content

Commit

Permalink
staging: hv: Remove NULL check before kfree
Browse files Browse the repository at this point in the history
This patch was generated by the following semantic patch:
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);

@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Mike Sterling <mike.sterling@microsoft.com>
Cc: Abhishek Kane <v-abkane@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ilia Mirkin authored and Greg Kroah-Hartman committed Mar 14, 2011
1 parent e13a0b5 commit dd9b15d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,7 @@ int vmbus_request_offers(void)


cleanup:
if (msginfo)
kfree(msginfo);
kfree(msginfo);

return ret;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/staging/hv/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ int vmbus_connect(void)
vmbus_connection.monitor_pages = NULL;
}

if (msginfo) {
kfree(msginfo);
}
kfree(msginfo);

return ret;
}
Expand Down
12 changes: 4 additions & 8 deletions drivers/staging/hv/hv_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,11 @@ static void MousevscOnReceiveDeviceInfo(struct mousevsc_dev *InputDevice, struct
return;

Cleanup:
if (InputDevice->HidDesc) {
kfree(InputDevice->HidDesc);
InputDevice->HidDesc = NULL;
}
kfree(InputDevice->HidDesc);
InputDevice->HidDesc = NULL;

if (InputDevice->ReportDesc) {
kfree(InputDevice->ReportDesc);
InputDevice->ReportDesc = NULL;
}
kfree(InputDevice->ReportDesc);
InputDevice->ReportDesc = NULL;

InputDevice->DeviceInfoStatus = -1;
InputDevice->device_wait_condition = 1;
Expand Down

0 comments on commit dd9b15d

Please sign in to comment.