| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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 | | - * |
|---|
| 13 | 4 | */ |
|---|
| 14 | 5 | #include <linux/device.h> |
|---|
| 15 | 6 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 88 | 79 | { |
|---|
| 89 | 80 | struct optee *optee = tee_get_drvdata(ctx->teedev); |
|---|
| 90 | 81 | struct optee_supp *supp = &optee->supp; |
|---|
| 91 | | - struct optee_supp_req *req = kzalloc(sizeof(*req), GFP_KERNEL); |
|---|
| 82 | + struct optee_supp_req *req; |
|---|
| 92 | 83 | bool interruptable; |
|---|
| 93 | 84 | u32 ret; |
|---|
| 94 | 85 | unsigned long timeleft; |
|---|
| 95 | 86 | int id; |
|---|
| 96 | 87 | struct optee_supp_req *get_req; |
|---|
| 97 | 88 | |
|---|
| 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); |
|---|
| 98 | 97 | if (!req) |
|---|
| 99 | 98 | return TEEC_ERROR_OUT_OF_MEMORY; |
|---|
| 100 | 99 | |
|---|