tpm: simplify: tpm_set_global_lock()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 5 Feb 2019 00:38:41 +0000 (01:38 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 19 Feb 2019 13:55:43 +0000 (08:55 -0500)
When in pack_byte_string() memcpy() is called for size 0 the source buffer
address has no relevance. So we can use NULL here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
lib/tpm-v1.c

index 3e89f84..b4498e6 100644 (file)
@@ -211,9 +211,7 @@ u32 tpm_nv_write_value(struct udevice *dev, u32 index, const void *data,
 
 uint32_t tpm_set_global_lock(struct udevice *dev)
 {
-       u32 x;
-
-       return tpm_nv_write_value(dev, TPM_NV_INDEX_0, (uint8_t *)&x, 0);
+       return tpm_nv_write_value(dev, TPM_NV_INDEX_0, NULL, 0);
 }
 
 u32 tpm_extend(struct udevice *dev, u32 index, const void *in_digest,