aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.10/0109-vchiq-fix-the-shim-message-release.patch
blob: 0442280e42b1c2e15ecf1da4957386731a4f2986 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 4791194922d8ab361136d462a23e897b459d1a2a Mon Sep 17 00:00:00 2001
From: Vincent Sanders <vincent.sanders@collabora.co.uk>
Date: Mon, 30 Sep 2013 17:04:55 +0100
Subject: [PATCH 109/196] vchiq: fix the shim message release

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 47 +++++++++++++---------
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
index f752f8d..fe9bd80 100644
--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -545,47 +545,58 @@ static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
 	SHIM_SERVICE_T *service =
 		(SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle);
 
+        if (!service->callback)
+		goto release;
+
 	switch (reason) {
 	case VCHIQ_MESSAGE_AVAILABLE:
 		vchiu_queue_push(&service->queue, header);
 
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_MSG_AVAILABLE, NULL);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_MSG_AVAILABLE, NULL);
+
+		goto done;
 		break;
+
 	case VCHIQ_BULK_TRANSMIT_DONE:
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_BULK_SENT, bulk_user);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_BULK_SENT, bulk_user);
 		break;
+
 	case VCHIQ_BULK_RECEIVE_DONE:
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
 		break;
+
 	case VCHIQ_SERVICE_CLOSED:
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_SERVICE_CLOSED, NULL);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_SERVICE_CLOSED, NULL);
 		break;
+
 	case VCHIQ_SERVICE_OPENED:
 		/* No equivalent VCHI reason */
 		break;
+
 	case VCHIQ_BULK_TRANSMIT_ABORTED:
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, bulk_user);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
+				  bulk_user);
 		break;
+
 	case VCHIQ_BULK_RECEIVE_ABORTED:
-		if (service->callback)
-			service->callback(service->callback_param,
-				VCHI_CALLBACK_BULK_RECEIVE_ABORTED, bulk_user);
+		service->callback(service->callback_param,
+				  VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
+				  bulk_user);
 		break;
+
 	default:
 		WARN(1, "not supported\n");
 		break;
 	}
 
+release:
+        vchiq_release_message(service->handle, header);
+done:
 	return VCHIQ_SUCCESS;
 }
 
-- 
1.9.1