summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccp/ccp-crypto-main.c
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2015-10-01 16:32:31 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2015-10-08 21:42:15 +0800
commit355eba5dda6984cbe10fa914e5cc8ef45a34cce2 (patch)
treecb5b8eb7a43f917ef7e982e0a24e7c1e79c8a8aa /drivers/crypto/ccp/ccp-crypto-main.c
parent9196d9676fe790975fdb1fc03230629139c6ea8e (diff)
crypto: ccp - Replace BUG_ON with WARN_ON and a return code
Replace the usage of BUG_ON with WARN_ON and return an error. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-crypto-main.c')
-rw-r--r--drivers/crypto/ccp/ccp-crypto-main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c
index bdec01ec608f..e0380e59c361 100644
--- a/drivers/crypto/ccp/ccp-crypto-main.c
+++ b/drivers/crypto/ccp/ccp-crypto-main.c
@@ -305,14 +305,16 @@ struct scatterlist *ccp_crypto_sg_table_add(struct sg_table *table,
for (sg = table->sgl; sg; sg = sg_next(sg))
if (!sg_page(sg))
break;
- BUG_ON(!sg);
+ if (WARN_ON(!sg))
+ return NULL;
for (; sg && sg_add; sg = sg_next(sg), sg_add = sg_next(sg_add)) {
sg_set_page(sg, sg_page(sg_add), sg_add->length,
sg_add->offset);
sg_last = sg;
}
- BUG_ON(sg_add);
+ if (WARN_ON(sg_add))
+ return NULL;
return sg_last;
}