From: Kai Ye yekai13@huawei.com
Unify print format with following rules: 1. failed to do sth. 2. invalid: sth is NULL.
Signed-off-by: Kai Ye yekai13@huawei.com --- drv/hisi_sec.c | 20 ++++++++++---------- wd_aead.c | 12 ++++++------ wd_cipher.c | 20 ++++++++++---------- wd_digest.c | 10 +++++----- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 16fcb5f..aa86a6b 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -703,7 +703,7 @@ static void parse_cipher_bd2(struct hisi_sec_sqe *sqe,
done = sqe->type2.done_flag & SEC_DONE_MASK; if (done != SEC_HW_TASK_DONE || sqe->type2.error_type) { - WD_ERR("SEC BD %s fail! done=0x%x, etype=0x%x\n", "cipher", + WD_ERR("failed to parse cipher BD2! done=0x%x, etype=0x%x\n", done, sqe->type2.error_type); recv_msg->result = WD_IN_EPARA; } else { @@ -927,7 +927,7 @@ int hisi_sec_cipher_send(handle_t ctx, struct wd_cipher_msg *msg) int ret;
if (!msg) { - WD_ERR("input cipher msg is NULL!\n"); + WD_ERR("invalid: input cipher msg is NULL!\n"); return -WD_EINVAL; }
@@ -1130,7 +1130,7 @@ int hisi_sec_cipher_send_v3(handle_t ctx, struct wd_cipher_msg *msg) int ret;
if (!msg) { - WD_ERR("input cipher msg is NULL!\n"); + WD_ERR("invalid: input cipher msg is NULL!\n"); return -WD_EINVAL; }
@@ -1175,7 +1175,7 @@ static void parse_cipher_bd3(struct hisi_sec_sqe3 *sqe,
done = sqe->done_flag & SEC_DONE_MASK; if (done != SEC_HW_TASK_DONE || sqe->error_type) { - WD_ERR("SEC BD3 %s fail! done=0x%x, etype=0x%x\n", "cipher", + WD_ERR("failed to parse cipher BD3! done=0x%x, etype=0x%x\n", done, sqe->error_type); recv_msg->result = WD_IN_EPARA; } else { @@ -1278,7 +1278,7 @@ static void parse_digest_bd2(struct hisi_sec_sqe *sqe,
done = sqe->type2.done_flag & SEC_DONE_MASK; if (done != SEC_HW_TASK_DONE || sqe->type2.error_type) { - WD_ERR("SEC BD %s fail! done=0x%x, etype=0x%x\n", "digest", + WD_ERR("failed to parse digest BD2! done=0x%x, etype=0x%x\n", done, sqe->type2.error_type); recv_msg->result = WD_IN_EPARA; } else { @@ -1354,7 +1354,7 @@ int hisi_sec_digest_send(handle_t ctx, struct wd_digest_msg *msg) int ret;
if (!msg) { - WD_ERR("input digest msg is NULL!\n"); + WD_ERR("invalid: input digest msg is NULL!\n"); return -WD_EINVAL; }
@@ -1510,7 +1510,7 @@ int hisi_sec_digest_send_v3(handle_t ctx, struct wd_digest_msg *msg) int ret;
if (!msg) { - WD_ERR("input digest msg is NULL!\n"); + WD_ERR("invalid: input digest msg is NULL!\n"); return -WD_EINVAL; }
@@ -1578,7 +1578,7 @@ static void parse_digest_bd3(struct hisi_sec_sqe3 *sqe,
done = sqe->done_flag & SEC_DONE_MASK; if (done != SEC_HW_TASK_DONE || sqe->error_type) { - WD_ERR("SEC BD3 %s fail! done=0x%x, etype=0x%x\n", "digest", + WD_ERR("failed to parse digest BD3! done=0x%x, etype=0x%x\n", done, sqe->error_type); recv_msg->result = WD_IN_EPARA; } else { @@ -1927,7 +1927,7 @@ static void parse_aead_bd2(struct hisi_sec_sqe *sqe, icv = (sqe->type2.done_flag & SEC_ICV_MASK) >> 1; if (done != SEC_HW_TASK_DONE || sqe->type2.error_type || icv == SEC_HW_ICV_ERR) { - WD_ERR("SEC BD aead fail! done=0x%x, etype=0x%x, icv=0x%x\n", + WD_ERR("failed to parse aead BD2! done=0x%x, etype=0x%x, icv=0x%x\n", done, sqe->type2.error_type, icv); recv_msg->result = WD_IN_EPARA; } else { @@ -2195,7 +2195,7 @@ static void parse_aead_bd3(struct hisi_sec_sqe3 *sqe, icv = (sqe->done_flag & SEC_ICV_MASK) >> 1; if (done != SEC_HW_TASK_DONE || sqe->error_type || icv == SEC_HW_ICV_ERR) { - WD_ERR("SEC BD3 aead fail! done=0x%x, etype=0x%x, icv=0x%x\n", + WD_ERR("failed to parse aead BD3! done=0x%x, etype=0x%x, icv=0x%x\n", done, sqe->error_type, icv); recv_msg->result = WD_IN_EPARA; } else { diff --git a/wd_aead.c b/wd_aead.c index 7df8e80..74047b5 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -63,14 +63,14 @@ static void wd_aead_set_static_drv(void) { wd_aead_setting.driver = wd_aead_get_driver(); if (!wd_aead_setting.driver) - WD_ERR("fail to get driver\n"); + WD_ERR("failed to get driver!\n"); } #else static void __attribute__((constructor)) wd_aead_open_driver(void) { wd_aead_setting.dlhandle = dlopen("libhisi_sec.so", RTLD_NOW); if (!wd_aead_setting.dlhandle) - WD_ERR("failed to open libhisi_sec.so\n"); + WD_ERR("failed to open libhisi_sec.so!\n"); }
static void __attribute__((destructor)) wd_aead_close_driver(void) @@ -344,7 +344,7 @@ static int aead_param_check(struct wd_aead_sess *sess, int ret;
if (unlikely(!sess || !req)) { - WD_ERR("aead input sess or req is NULL.\n"); + WD_ERR("invalid: aead input sess or req is NULL!\n"); return -WD_EINVAL; }
@@ -393,7 +393,7 @@ static int aead_param_check(struct wd_aead_sess *sess, static int aead_init_check(struct wd_ctx_config *config, struct wd_sched *sched) { if (!config || !config->ctxs || !config->ctxs[0].ctx || !sched) { - WD_ERR("wd aead config or sched is NULL!\n"); + WD_ERR("invalid: wd aead config or sched is NULL!\n"); return -WD_EINVAL; }
@@ -594,7 +594,7 @@ int wd_do_aead_async(handle_t h_sess, struct wd_aead_req *req) return -WD_EINVAL;
if (unlikely(!req->cb)) { - WD_ERR("aead input req cb is NULL.\n"); + WD_ERR("invalid: aead input req cb is NULL!\n"); return -WD_EINVAL; }
@@ -647,7 +647,7 @@ int wd_aead_poll_ctx(__u32 idx, __u32 expt, __u32 *count) int ret;
if (!count) { - WD_ERR("aead poll ctx input param is NULL!\n"); + WD_ERR("invalid: aead poll ctx input param is NULL!\n"); return -WD_EINVAL; }
diff --git a/wd_cipher.c b/wd_cipher.c index afd8c4d..3a9b323 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -75,14 +75,14 @@ static void wd_cipher_set_static_drv(void) { wd_cipher_setting.driver = wd_cipher_get_driver(); if (!wd_cipher_setting.driver) - WD_ERR("fail to get driver\n"); + WD_ERR("failed to get driver!\n"); } #else static void __attribute__((constructor)) wd_cipher_open_driver(void) { wd_cipher_setting.dlhandle = dlopen("libhisi_sec.so", RTLD_NOW); if (!wd_cipher_setting.dlhandle) - WD_ERR("fail to open libhisi_sec.so\n"); + WD_ERR("failed to open libhisi_sec.so!\n"); }
static void __attribute__((destructor)) wd_cipher_close_driver(void) @@ -158,7 +158,7 @@ static int cipher_init_check(struct wd_ctx_config *config, struct wd_sched *sched) { if (!config || !config->ctxs || !config->ctxs[0].ctx || !sched) { - WD_ERR("wd cipher config or sched is NULL!\n"); + WD_ERR("invalid: wd cipher config or sched is NULL!\n"); return -WD_EINVAL; }
@@ -177,7 +177,7 @@ int wd_cipher_set_key(handle_t h_sess, const __u8 *key, __u32 key_len) int ret;
if (!key || !sess) { - WD_ERR("cipher set key input param err!\n"); + WD_ERR("invalid: cipher set key input param err!\n"); return -WD_EINVAL; }
@@ -205,13 +205,13 @@ handle_t wd_cipher_alloc_sess(struct wd_cipher_sess_setup *setup) struct wd_cipher_sess *sess = NULL;
if (unlikely(!setup)) { - WD_ERR("cipher input setup is NULL!\n"); + WD_ERR("invalid: cipher input setup is NULL!\n"); return (handle_t)0; }
sess = malloc(sizeof(struct wd_cipher_sess)); if (!sess) { - WD_ERR("fail to alloc session memory!\n"); + WD_ERR("failed to alloc session memory!\n"); return (handle_t)0; } memset(sess, 0, sizeof(struct wd_cipher_sess)); @@ -235,7 +235,7 @@ void wd_cipher_free_sess(handle_t h_sess) struct wd_cipher_sess *sess = (struct wd_cipher_sess *)h_sess;
if (unlikely(!sess)) { - WD_ERR("cipher input h_sess is NULL!\n"); + WD_ERR("invalid: cipher input h_sess is NULL!\n"); return; }
@@ -387,12 +387,12 @@ static int wd_cipher_check_params(handle_t h_sess, int ret = 0;
if (unlikely(!h_sess || !req)) { - WD_ERR("cipher input sess or req is NULL!\n"); + WD_ERR("invalid: cipher input sess or req is NULL!\n"); return -WD_EINVAL; }
if (unlikely(mode == CTX_MODE_ASYNC && !req->cb)) { - WD_ERR("cipher req cb is NULL!\n"); + WD_ERR("invalid: cipher req cb is NULL!\n"); return -WD_EINVAL; }
@@ -561,7 +561,7 @@ int wd_cipher_poll_ctx(__u32 idx, __u32 expt, __u32 *count) int ret;
if (unlikely(!count)) { - WD_ERR("wd cipher poll ctx input param is NULL!\n"); + WD_ERR("invalid: cipher poll ctx input param is NULL!\n"); return -WD_EINVAL; }
diff --git a/wd_digest.c b/wd_digest.c index fb29746..0ddc074 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -62,7 +62,7 @@ static void wd_digest_set_static_drv(void) { wd_digest_setting.driver = wd_digest_get_driver(); if (!wd_digest_setting.driver) - WD_ERR("fail to get driver\n"); + WD_ERR("failed to get driver!\n"); } #else static void __attribute__((constructor)) wd_digest_open_driver(void) @@ -70,7 +70,7 @@ static void __attribute__((constructor)) wd_digest_open_driver(void) /* Fix me: vendor driver should be put in /usr/lib/wd/ */ wd_digest_setting.dlhandle = dlopen("libhisi_sec.so", RTLD_NOW); if (!wd_digest_setting.dlhandle) - WD_ERR("fail to open libhisi_sec.so\n"); + WD_ERR("failed to open libhisi_sec.so!\n"); }
static void __attribute__((destructor)) wd_digest_close_driver(void) @@ -252,7 +252,7 @@ static int digest_param_check(struct wd_digest_sess *sess, int ret;
if (unlikely(!sess || !req)) { - WD_ERR("digest input sess or req is NULL.\n"); + WD_ERR("invalid: digest input sess or req is NULL!\n"); return -WD_EINVAL; }
@@ -398,7 +398,7 @@ int wd_do_digest_async(handle_t h_sess, struct wd_digest_req *req) return -WD_EINVAL;
if (unlikely(!req->cb)) { - WD_ERR("digest input req cb is NULL.\n"); + WD_ERR("invalid: digest input req cb is NULL!\n"); return -WD_EINVAL; }
@@ -451,7 +451,7 @@ int wd_digest_poll_ctx(__u32 idx, __u32 expt, __u32 *count) int ret;
if (unlikely(!count)) { - WD_ERR("digest count is NULL.\n"); + WD_ERR("invalid: digest poll ctx input param is NULL!\n"); return -WD_EINVAL; }