]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: sun8i-ce-hash - add IS_ENABLED() checks to debugfs stats
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Tue, 1 Apr 2025 19:23:20 +0000 (22:23 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 8 Apr 2025 07:54:38 +0000 (15:54 +0800)
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>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c

index 530c5181d73c0b2aad85a233d589948bf49cabb9..f2481e1585bacf1805d695353e1ce0e2785150aa 100644 (file)
@@ -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);