forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/tee/optee/supp.c
....@@ -1,15 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2015, Linaro Limited
3
- *
4
- * This software is licensed under the terms of the GNU General Public
5
- * License version 2, as published by the Free Software Foundation, and
6
- * may be copied, distributed, and modified under those terms.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
134 */
145 #include <linux/device.h>
156 #include <linux/slab.h>
....@@ -88,13 +79,21 @@
8879 {
8980 struct optee *optee = tee_get_drvdata(ctx->teedev);
9081 struct optee_supp *supp = &optee->supp;
91
- struct optee_supp_req *req = kzalloc(sizeof(*req), GFP_KERNEL);
82
+ struct optee_supp_req *req;
9283 bool interruptable;
9384 u32 ret;
9485 unsigned long timeleft;
9586 int id;
9687 struct optee_supp_req *get_req;
9788
89
+ /*
90
+ * Return in case there is no supplicant available and
91
+ * non-blocking request.
92
+ */
93
+ if (!supp->ctx && ctx->supp_nowait)
94
+ return TEEC_ERROR_COMMUNICATION;
95
+
96
+ req = kzalloc(sizeof(*req), GFP_KERNEL);
9897 if (!req)
9998 return TEEC_ERROR_OUT_OF_MEMORY;
10099