From 0d174f5d630808e1d8bf3e1067511671cc2562b3 Mon Sep 17 00:00:00 2001 From: Edgar Flores Date: Mon, 16 Mar 2020 22:43:31 -0700 Subject: [PATCH] msm: adsprpc: Validate smmu device is created before using it Validate that adsprpc driver does not use smmu device before device gets probe. Change-Id: Ica0ef5a6c3e4cabc731a0d71613e05e8a47c1622 Signed-off-by: Edgar Flores --- drivers/char/adsprpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 40d900e7ff1a..e8786d04b86b 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -1133,9 +1133,11 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, size_t size, struct fastrpc_buf *buf = NULL, *fr = NULL; struct hlist_node *n; - VERIFY(err, size > 0); - if (err) + VERIFY(err, size > 0 && fl->sctx->smmu.dev); + if (err) { + err = (fl->sctx->smmu.dev == NULL) ? -ENODEV : err; goto bail; + } if (!remote) { /* find the smallest buffer that fits in the cache */