aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2583-drm-amd-display-fix-ifnullfree.cocci-warnings.patch
blob: 9e0bca19fc4819bb7c468fcebb4d4606343350dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 15ba3b61dfa4fd6d551a1073fedc5e3f4ac21508 Mon Sep 17 00:00:00 2001
From: kbuild test robot <fengguang.wu@intel.com>
Date: Fri, 13 Oct 2017 07:17:48 +0800
Subject: [PATCH 2583/4131] drm/amd/display: fix ifnullfree.cocci warnings

drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: 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/dc/gpio/gpio_service.c:175:4-9: 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: f09cd1f46388 ("drm/amd/display: Use kernel alloc/free")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
index ff9d36b..80038e0 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
@@ -130,8 +130,7 @@ struct gpio_service *dal_gpio_service_create(
 
 		slot = service->busyness[index_of_id];
 
-		if (slot)
-			kfree(slot);
+		kfree(slot);
 	}
 
 failure_1:
@@ -171,8 +170,7 @@ void dal_gpio_service_destroy(
 		do {
 			uint32_t *slot = (*ptr)->busyness[index_of_id];
 
-			if (slot)
-				kfree(slot);
+			kfree(slot);
 
 			++index_of_id;
 		} while (index_of_id < GPIO_ID_COUNT);
-- 
2.7.4