Skip to contentSkip to conversation

tee: remove unnecessary NULL check in tee_shm_alloc()

PATCH New Dan Carpenter 1 participant 1 message Apr 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tee: remove unnecessary NULL check in tee_shm_alloc()

Smatch complains that "ctx" isn't checked consistently:

drivers/tee/tee_shm.c:164 tee_shm_alloc()
warn: variable dereferenced before check 'ctx' (see line 95)

I audited the callers and "ctx" can't be NULL so the check can be removed.

---
 drivers/tee/tee_shm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tee/tee_shm.c +1 -2
index bd679b72bd05..8895cb910166 100644
@@ -161,8 +161,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
 		}
 	}
 
-	if (ctx)
-		teedev_ctx_get(ctx);
+	teedev_ctx_get(ctx);
 
 	return shm;
 err_rem:
Signature · 1 line
2.25.1