Commit 5400261e authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed

net/mlx5: Fix a compilation warning in events.c

Eliminate the following compilation warning:

drivers/net/ethernet/mellanox/mlx5/core/events.c: warning: 'error_str'
may be used uninitialized in this function [-Wuninitialized]:  => 238:3

Fixes: c2fb3db2 ("net/mlx5: Rework handling of port module events")
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Reviewed-by: default avatarMikhael Goikhman <migo@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 4cab346b
...@@ -211,11 +211,10 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data ...@@ -211,11 +211,10 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data
enum port_module_event_status_type module_status; enum port_module_event_status_type module_status;
enum port_module_event_error_type error_type; enum port_module_event_error_type error_type;
struct mlx5_eqe_port_module *module_event_eqe; struct mlx5_eqe_port_module *module_event_eqe;
const char *status_str, *error_str; const char *status_str;
u8 module_num; u8 module_num;
module_event_eqe = &eqe->data.port_module; module_event_eqe = &eqe->data.port_module;
module_num = module_event_eqe->module;
module_status = module_event_eqe->module_status & module_status = module_event_eqe->module_status &
PORT_MODULE_EVENT_MODULE_STATUS_MASK; PORT_MODULE_EVENT_MODULE_STATUS_MASK;
error_type = module_event_eqe->error_type & error_type = module_event_eqe->error_type &
...@@ -223,25 +222,27 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data ...@@ -223,25 +222,27 @@ static int port_module(struct notifier_block *nb, unsigned long type, void *data
if (module_status < MLX5_MODULE_STATUS_NUM) if (module_status < MLX5_MODULE_STATUS_NUM)
events->pme_stats.status_counters[module_status]++; events->pme_stats.status_counters[module_status]++;
status_str = mlx5_pme_status_to_string(module_status);
if (module_status == MLX5_MODULE_STATUS_ERROR) { if (module_status == MLX5_MODULE_STATUS_ERROR)
if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) if (error_type < MLX5_MODULE_EVENT_ERROR_NUM)
events->pme_stats.error_counters[error_type]++; events->pme_stats.error_counters[error_type]++;
error_str = mlx5_pme_error_to_string(error_type);
}
if (!printk_ratelimit()) if (!printk_ratelimit())
return NOTIFY_OK; return NOTIFY_OK;
if (module_status == MLX5_MODULE_STATUS_ERROR) module_num = module_event_eqe->module;
status_str = mlx5_pme_status_to_string(module_status);
if (module_status == MLX5_MODULE_STATUS_ERROR) {
const char *error_str = mlx5_pme_error_to_string(error_type);
mlx5_core_err(events->dev, mlx5_core_err(events->dev,
"Port module event[error]: module %u, %s, %s\n", "Port module event[error]: module %u, %s, %s\n",
module_num, status_str, error_str); module_num, status_str, error_str);
else } else {
mlx5_core_info(events->dev, mlx5_core_info(events->dev,
"Port module event: module %u, %s\n", "Port module event: module %u, %s\n",
module_num, status_str); module_num, status_str);
}
return NOTIFY_OK; return NOTIFY_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment