summaryrefslogtreecommitdiff
path: root/src/security/tpm/tss
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-09-13 09:56:22 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-09-15 13:02:33 +0000
commitaebccac7e10eb581e8e7d3354289cfed76860a3e (patch)
treeffb8e6a5bb256f8675e0496f27c6991c524d1e9b /src/security/tpm/tss
parenta6b41f2fd05c61ea74bea4a40d02250e9b37bee0 (diff)
src/security: Use "if (!ptr)" in preference to "if (ptr == NULL)"
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I3def65c016015d8213824e6b8561d8a67b6d5cf0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67579 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/security/tpm/tss')
-rw-r--r--src/security/tpm/tss/tcg-2.0/tss.c4
-rw-r--r--src/security/tpm/tss/tcg-2.0/tss_marshaling.c2
-rw-r--r--src/security/tpm/tss/vendor/cr50/cr50.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c
index 8c9d12f7b0..5d6cbf89b6 100644
--- a/src/security/tpm/tss/tcg-2.0/tss.c
+++ b/src/security/tpm/tss/tcg-2.0/tss.c
@@ -55,7 +55,7 @@ static uint32_t tlcl_send_startup(TPM_SU type)
response = tpm_process_command(TPM2_Startup, &startup);
/* IO error, tpm2_response pointer is empty. */
- if (response == NULL) {
+ if (!response) {
printk(BIOS_ERR, "%s: TPM communication error\n", __func__);
return TPM_E_IOERROR;
}
@@ -89,7 +89,7 @@ static uint32_t tlcl_send_shutdown(TPM_SU type)
response = tpm_process_command(TPM2_Shutdown, &shutdown);
/* IO error, tpm2_response pointer is empty. */
- if (response == NULL) {
+ if (!response) {
printk(BIOS_ERR, "%s: TPM communication error\n", __func__);
return TPM_E_IOERROR;
}
diff --git a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
index ae623043e6..f1b9522e6c 100644
--- a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
+++ b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
@@ -517,7 +517,7 @@ static int unmarshal_TPM2B_MAX_NV_BUFFER(struct ibuf *ib,
nv_buffer->t.buffer = ibuf_oob_drain(ib, nv_buffer->t.size);
- if (nv_buffer->t.buffer == NULL) {
+ if (!nv_buffer->t.buffer) {
printk(BIOS_ERR, "%s:%d - "
"size mismatch: expected %d, remaining %zd\n",
__func__, __LINE__, nv_buffer->t.size,
diff --git a/src/security/tpm/tss/vendor/cr50/cr50.c b/src/security/tpm/tss/vendor/cr50/cr50.c
index e38ca30ad4..57d0b61a24 100644
--- a/src/security/tpm/tss/vendor/cr50/cr50.c
+++ b/src/security/tpm/tss/vendor/cr50/cr50.c
@@ -18,7 +18,7 @@ uint32_t tlcl_cr50_enable_nvcommits(void)
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, &sub_command);
- if (response == NULL || (response && response->hdr.tpm_code)) {
+ if (!response || (response && response->hdr.tpm_code)) {
if (response)
printk(BIOS_INFO, "%s: failed %x\n", __func__,
response->hdr.tpm_code);