From 59c8afbc89608af2212ad1a5e06d8536b595eeed Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 15 Nov 2023 17:39:10 +0100 Subject: [PATCH] repart: Fix compilation warning when tpm2 is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning is about unused variable "flags": ``` ../src/partition/repart.c: In function ‘partition_encrypt’: ../src/partition/repart.c:3690:19: warning: unused variable ‘flags’ [-Wunused-variable] 3690 | TPM2Flags flags = 0; | ^~~~~ ``` Move the flags variable into the scope where it is actually used, which happens to be inside the HAVE_TPM2 block. --- src/partition/repart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partition/repart.c b/src/partition/repart.c index 88d4c5186d..654b931c19 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3687,7 +3687,6 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta _cleanup_free_ char *hp = NULL, *vol = NULL, *dm_name = NULL; const char *passphrase = NULL; size_t passphrase_size = 0; - TPM2Flags flags = 0; const char *vt; int r; @@ -3782,6 +3781,7 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta size_t secret_size, blob_size, pubkey_size = 0, srk_buf_size = 0; ssize_t base64_encoded_size; int keyslot; + TPM2Flags flags = 0; if (arg_tpm2_public_key_pcr_mask != 0) { r = tpm2_load_pcr_public_key(arg_tpm2_public_key, &pubkey, &pubkey_size);