Skip to contentSkip to conversation

crypto: cleanup: remove unneeded null check

PATCH In review Dan Carpenter 2 participants 2 messages Apr 28, 2010 – May 3, 2010

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

PATCH 1/1 crypto: cleanup: remove unneeded null check

We don't check "frontend" consistently in crypto_init_spawn2(). We check it at the start of the function but then we dereference it unconditionally in the parameter list when we call crypto_init_spawn().

I looked at the places that call crypto_init_spawn2() and "frontend" is always a valid pointer so I removed the check for null.

crypto/algapi.c +1 -1
index 76fae27..c3cf1a6 100644
@@ -544,7 +544,7 @@ int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg,
 {
 	int err = -EINVAL;
 
-	if (frontend && (alg->cra_flags ^ frontend->type) & frontend->maskset)
+	if ((alg->cra_flags ^ frontend->type) & frontend->maskset)
 		goto out;
 
 	spawn->frontend = frontend;