From f484c0e64863dc2510d2600710c78a7559ef3e9a Mon Sep 17 00:00:00 2001 From: Chris Goldsworthy Date: Tue, 11 Oct 2022 20:30:08 -0700 Subject: [PATCH] mem-buf: Exit mem_buf_lend_internal if the mem-buf not probed Exit with an error from mem_buf_lend_internal() if the driver hasn't probed. Change-Id: Ide42166c2f850197f989a228f9139d401411a914 Signed-off-by: Chris Goldsworthy --- drivers/soc/qcom/mem_buf/mem_buf_dma_buf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/soc/qcom/mem_buf/mem_buf_dma_buf.c b/drivers/soc/qcom/mem_buf/mem_buf_dma_buf.c index c1f080885c44..f356cdf23a5f 100644 --- a/drivers/soc/qcom/mem_buf/mem_buf_dma_buf.c +++ b/drivers/soc/qcom/mem_buf/mem_buf_dma_buf.c @@ -452,6 +452,11 @@ static int mem_buf_lend_internal(struct dma_buf *dmabuf, if (!arg->nr_acl_entries || !arg->vmids || !arg->perms) return -EINVAL; + if (!mem_buf_dev) { + pr_err("%s: mem-buf driver not probed!\n", __func__); + return -ENODEV; + } + vmperm = to_mem_buf_vmperm(dmabuf); if (IS_ERR(vmperm)) { pr_err_ratelimited("dmabuf ops %ps are not a mem_buf_dma_buf_ops\n",