zconf/zcrypt: Fix sparse warnings

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 <ifranzki@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2021-06-21 11:08:56 +02:00
committed by Jan Höppner
parent 9100d6f40e
commit 3e818c53b2
3 changed files with 16 additions and 22 deletions

View File

@@ -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");

View File

@@ -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");

View File

@@ -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 = {