mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 00:15:49 -04:00
crypto: sun8i-ce-hash - add IS_ENABLED() checks to debugfs stats
Add IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG) checks before the fallback counter updates to make sure the code is not included when debugfs statistics support is not enabled. Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
a8632253f3
commit
593c76e1aa
@@ -60,8 +60,10 @@ int sun8i_ce_hash_init_tfm(struct crypto_ahash *tfm)
|
||||
sizeof(struct sun8i_ce_hash_reqctx) +
|
||||
crypto_ahash_reqsize(op->fallback_tfm));
|
||||
|
||||
memcpy(algt->fbname, crypto_ahash_driver_name(op->fallback_tfm),
|
||||
CRYPTO_MAX_ALG_NAME);
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
|
||||
memcpy(algt->fbname,
|
||||
crypto_ahash_driver_name(op->fallback_tfm),
|
||||
CRYPTO_MAX_ALG_NAME);
|
||||
|
||||
err = pm_runtime_get_sync(op->ce->dev);
|
||||
if (err < 0)
|
||||
@@ -198,22 +200,30 @@ static bool sun8i_ce_hash_need_fallback(struct ahash_request *areq)
|
||||
algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base);
|
||||
|
||||
if (areq->nbytes == 0) {
|
||||
algt->stat_fb_len0++;
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
|
||||
algt->stat_fb_len0++;
|
||||
|
||||
return true;
|
||||
}
|
||||
/* we need to reserve one SG for padding one */
|
||||
if (sg_nents_for_len(areq->src, areq->nbytes) > MAX_SG - 1) {
|
||||
algt->stat_fb_maxsg++;
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
|
||||
algt->stat_fb_maxsg++;
|
||||
|
||||
return true;
|
||||
}
|
||||
sg = areq->src;
|
||||
while (sg) {
|
||||
if (sg->length % 4) {
|
||||
algt->stat_fb_srclen++;
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
|
||||
algt->stat_fb_srclen++;
|
||||
|
||||
return true;
|
||||
}
|
||||
if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
|
||||
algt->stat_fb_srcali++;
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
|
||||
algt->stat_fb_srcali++;
|
||||
|
||||
return true;
|
||||
}
|
||||
sg = sg_next(sg);
|
||||
|
||||
Reference in New Issue
Block a user