summaryrefslogtreecommitdiff
path: root/test/lib/asn1.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-07-31 17:08:41 +0300
committerTom Rini <trini@konsulko.com>2023-08-08 17:41:52 -0400
commit939390b203dde8a0176dbfa272dcb7bc54949baf (patch)
treee56938242303aadb44ab2dc5925299f0622c2747 /test/lib/asn1.c
parentd864bd0e21ad6ab901bc6365abc8c3dbebe3ad29 (diff)
downloadu-boot-939390b203dde8a0176dbfa272dcb7bc54949baf.tar.gz
u-boot-939390b203dde8a0176dbfa272dcb7bc54949baf.tar.bz2
u-boot-939390b203dde8a0176dbfa272dcb7bc54949baf.zip
test: fix a couple NULL vs IS_ERR() checks
The x509_cert_parse() and pkcs7_parse_message() functions return error pointers. They don't return NULL. Update the checks accordingly. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/lib/asn1.c')
-rw-r--r--test/lib/asn1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lib/asn1.c b/test/lib/asn1.c
index 8661fdd306..a66cdd77df 100644
--- a/test/lib/asn1.c
+++ b/test/lib/asn1.c
@@ -120,7 +120,7 @@ static int lib_asn1_x509(struct unit_test_state *uts)
cert = x509_cert_parse(cert_data, cert_data_len);
- ut_assertf(cert != NULL, "decoding failed\n");
+ ut_assertf(!IS_ERR(cert), "decoding failed\n");
ut_assertf(!strcmp(cert->subject, "Linaro: Tester"),
"subject doesn't match\n");
ut_assertf(!strcmp(cert->issuer, "Linaro: Tester"),
@@ -313,7 +313,7 @@ static int lib_asn1_pkcs7(struct unit_test_state *uts)
pkcs7 = pkcs7_parse_message(image_pk7, image_pk7_len);
- ut_assertf(pkcs7 != NULL, "decoding failed\n");
+ ut_assertf(!IS_ERR(pkcs7), "decoding failed\n");
ut_assertf(pkcs7->data_len == 104, "signature size doesn't match\n");
ut_assertf(pkcs7->signed_infos != NULL, "sign-info doesn't exist\n");
ut_assertf(pkcs7->signed_infos->msgdigest_len == 32,