From 3e818c53b2fdf2397ece12952eb6ee177bf8b217 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Mon, 21 Jun 2021 11:08:56 +0200 Subject: [PATCH] zconf/zcrypt: Fix sparse warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A compile with sparse (make C=1) shows a couple of warnings: like: chzcrypt.c:36:3: warning: symbol 'l' was not declared. Should it be static? lszcrypt.c: In function 'show_device': lszcrypt.c:556:9: warning: 'card' may be used uninitialized [-Wmaybe-uninitialized] Fix those warnings. Signed-off-by: Ingo Franzki Reviewed-by: Jan Hoeppner Signed-off-by: Jan Höppner --- zconf/zcrypt/chzcrypt.c | 8 +++----- zconf/zcrypt/lszcrypt.c | 10 +++------- zconf/zcrypt/zcryptstats.c | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/zconf/zcrypt/chzcrypt.c b/zconf/zcrypt/chzcrypt.c index 78ecc38e..68b36a5d 100644 --- a/zconf/zcrypt/chzcrypt.c +++ b/zconf/zcrypt/chzcrypt.c @@ -31,16 +31,14 @@ /* * Private data */ -struct chzcrypt_l { +static struct chzcrypt_l { int verbose; } l; -struct chzcrypt_l *chzcrypt_l = &l; - /* * Program configuration */ -const struct util_prg prg = { +static const struct util_prg prg = { .desc = "Modify zcrypt configuration.", .args = "[DEVICE_IDS]", .copyright_vec = { @@ -385,7 +383,7 @@ static void dev_list_argv(char **argz, size_t *len, char * const argv[]) /* * Describe adapter ids */ -void print_adapter_id_help(void) +static void print_adapter_id_help(void) { printf("\n"); printf("DEVICE_IDS\n"); diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c index 5fcd278d..f0a089a0 100644 --- a/zconf/zcrypt/lszcrypt.c +++ b/zconf/zcrypt/lszcrypt.c @@ -25,12 +25,10 @@ /* * Private data */ -struct lszcrypt_l { +static struct lszcrypt_l { int verbose; } l; -struct lszcrypt_l *lszcrypt_l = &l; - /* * Capabilities */ @@ -79,7 +77,7 @@ static struct fac_bits_s { /* * Program configuration */ -const struct util_prg prg = { +static const struct util_prg prg = { .desc = "Display zcrypt device and configuration information.", .args = "[DEVICE_IDS]", .copyright_vec = { @@ -553,8 +551,6 @@ static void show_device(struct util_rec *rec, const char *device) { char *grp_dev, card[16]; - util_rec_set(rec, "card", card); - strcpy(card, &device[4]); grp_dev = util_path_sysfs("devices/ap/%s", device); if (!util_path_is_dir(grp_dev)) @@ -707,7 +703,7 @@ static void show_devices_argv(char *argv[]) /* * Describe adapter ids */ -void print_adapter_id_help(void) +static void print_adapter_id_help(void) { printf("\n"); printf("DEVICE_IDS\n"); diff --git a/zconf/zcrypt/zcryptstats.c b/zconf/zcrypt/zcryptstats.c index 2456e5db..2f2c4d18 100644 --- a/zconf/zcrypt/zcryptstats.c +++ b/zconf/zcrypt/zcryptstats.c @@ -170,13 +170,13 @@ struct crypto_type { }; #define NUM_COPROC_COUNTERS 2 -const struct crypto_counter counter_coproc[NUM_COPROC_COUNTERS] = { +static const struct crypto_counter counter_coproc[NUM_COPROC_COUNTERS] = { { .name = "All", .is_totals = true }, { .name = "RSA Key-gen" }, }; #define NUM_ACCEL_COUNTERS 6 -const struct crypto_counter counter_accel[NUM_ACCEL_COUNTERS] = { +static const struct crypto_counter counter_accel[NUM_ACCEL_COUNTERS] = { { .name = "RSA 1024 ME" }, { .name = "RSA 2048 ME" }, { .name = "RSA 1024 CRT" }, @@ -186,7 +186,7 @@ const struct crypto_counter counter_accel[NUM_ACCEL_COUNTERS] = { }; #define NUM_EP11_COUNTERS 5 -const struct crypto_counter counter_ep11[NUM_EP11_COUNTERS] = { +static const struct crypto_counter counter_ep11[NUM_EP11_COUNTERS] = { { .name = "Asym. Slow" }, { .name = "Asym. Fast" }, { .name = "Symm. Partial" }, @@ -195,7 +195,7 @@ const struct crypto_counter counter_ep11[NUM_EP11_COUNTERS] = { }; #define NUM_PCICA_COUNTERS 20 -const struct crypto_counter counter_pcica[NUM_PCICA_COUNTERS] = { +static const struct crypto_counter counter_pcica[NUM_PCICA_COUNTERS] = { { .name = "RSA 1024 ME (E0)" }, { .name = "RSA 2048 ME (E0)" }, { .name = "RSA 1024 CRT (E0)" }, @@ -219,25 +219,25 @@ const struct crypto_counter counter_pcica[NUM_PCICA_COUNTERS] = { }; #define NUM_COPROC_MODES 1 -const struct crypto_mode mode_coproc[1] = { +static const struct crypto_mode mode_coproc[1] = { { .num_counters = NUM_COPROC_COUNTERS, .counters = counter_coproc}, }; #define NUM_ACCEL_MODES 1 -const struct crypto_mode mode_accel[1] = { +static const struct crypto_mode mode_accel[1] = { { .num_counters = NUM_ACCEL_COUNTERS, .counters = counter_accel }, }; #define NUM_PCICA_MODES 1 -const struct crypto_mode mode_pcica[1] = { +static const struct crypto_mode mode_pcica[1] = { { .num_counters = NUM_PCICA_COUNTERS, .counters = counter_pcica }, }; #define NUM_CEX4567_MODES 11 -const struct crypto_mode mode_cex4567[NUM_CEX4567_MODES] = { +static const struct crypto_mode mode_cex4567[NUM_CEX4567_MODES] = { { 0 }, { 0 }, { 0 }, @@ -258,7 +258,7 @@ const struct crypto_mode mode_cex4567[NUM_CEX4567_MODES] = { }; #define NUM_CRYPTO_TYPES 14 -const struct crypto_type crypto_types[NUM_CRYPTO_TYPES] = { +static const struct crypto_type crypto_types[NUM_CRYPTO_TYPES] = { { 0 }, { 0 }, { 0 }, @@ -430,7 +430,7 @@ static const struct print_func csv_print = { /* * Program configuration */ -const struct util_prg prg = { +static const struct util_prg prg = { .desc = "Display usage statistics of IBM Crypto Express adapters", .args = "[DEVICE_IDS]", .copyright_vec = {