Re: [PATCH v5 06/25] s390/zcrypt: Introduce cprb mempool for cca misc functions

Heiko Carstens
2025-04-15T15:07:46Z

> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index f753c0403a18..9ca78411737f 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -50,6 +50,10 @@ MODULE_DESCRIPTION("Cryptographic Coprocessor interface, " \
> "Copyright IBM Corp. 2001, 2012");
> MODULE_LICENSE("GPL");
>
> +unsigned int zcrypt_mempool_threshold = 5;
> +module_param_named(mempool_threshold, zcrypt_mempool_threshold, uint, 0440);
> +MODULE_PARM_DESC(mempool_threshold, "CCA and EP11 request/reply mempool minimal items (min: 1).");

Please remove the "." from the module parameter description, here, and
in all other patches which introduce new module parameters.

> -void __exit zcrypt_ccamisc_exit(void)
> +int __init zcrypt_ccamisc_init(void)
> +{
> + /* Pre-allocate a small memory pool for cca cprbs. */
> + cprb_mempool = mempool_create_kmalloc_pool(zcrypt_mempool_threshold,
> + CPRB_MEMPOOL_ITEM_SIZE);
> + if (!cprb_mempool) {
> + ZCRYPT_DBF_WARN("%s mempool_create(%d,%d) failed: %ld\n",
> + __func__, zcrypt_mempool_threshold,
> + CPRB_MEMPOOL_ITEM_SIZE, PTR_ERR(cprb_mempool));
> + return -ENOMEM;
> + }
> + return 0;
> +}

Please remove the ZCRYPT_DBF_WARN() for the !cprb_mempool case, and
just keep the return code handling. This will never fail, except for
the memory allocation error injection case, which is not relevant for
production code. If this is forced to fail you will see a nice splat
anyway; so no point in logging this in any case.

Please also remove all similar constructs in subsequent patches.