diff mbox

drm/amd/display: fix ifnullfree.cocci warnings

Message ID 20170707011552.GA9334@lkp-sb04.lkp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu July 7, 2017, 1:15 a.m. UTC
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c:1802:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c:1804:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: 22cdbf5cc45d ("drm/amd/display: Universal cursor plane hook-up.")
CC: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 amdgpu_dm_types.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

--- a/drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_types.c
@@ -1798,10 +1798,8 @@  int amdgpu_dm_crtc_init(struct amdgpu_di
 	return 0;
 
 fail:
-	if (acrtc)
-		kfree(acrtc);
-	if (cursor_plane)
-		kfree(cursor_plane);
+	kfree(acrtc);
+	kfree(cursor_plane);
 	acrtc->crtc_id = -1;
 	return res;
 }