diff options
author | Liming Sun <limings@nvidia.com> | 2023-10-12 19:02:35 -0400 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-10-18 15:38:09 +0200 |
commit | 99c09c985e5973c8f0ad976ebae069548dd86f12 (patch) | |
tree | c390a17533c66feb227923cc69314b824e517b46 /drivers/platform/mellanox | |
parent | 0e51cb42438b8754d8f4cee4c802a8c5bb2cd5e0 (diff) | |
download | linux-99c09c985e5973c8f0ad976ebae069548dd86f12.tar.gz linux-99c09c985e5973c8f0ad976ebae069548dd86f12.tar.bz2 linux-99c09c985e5973c8f0ad976ebae069548dd86f12.zip |
platform/mellanox: mlxbf-tmfifo: Fix a warning message
This commit fixes the smatch static checker warning in function
mlxbf_tmfifo_rxtx_word() which complains data not initialized at
line 634 when IS_VRING_DROP() is TRUE.
Signed-off-by: Liming Sun <limings@nvidia.com>
Link: https://lore.kernel.org/r/20231012230235.219861-1-limings@nvidia.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/mellanox')
-rw-r--r-- | drivers/platform/mellanox/mlxbf-tmfifo.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c index fd38d8c8371e..ab7d7a1235b8 100644 --- a/drivers/platform/mellanox/mlxbf-tmfifo.c +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -609,24 +609,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, if (vring->cur_len + sizeof(u64) <= len) { /* The whole word. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, sizeof(u64)); - else - memcpy(&data, addr + vring->cur_len, - sizeof(u64)); + } else { + memcpy(&data, addr + vring->cur_len, + sizeof(u64)); } vring->cur_len += sizeof(u64); } else { /* Leftover bytes. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, len - vring->cur_len); - else - memcpy(&data, addr + vring->cur_len, - len - vring->cur_len); + } else { + data = 0; + memcpy(&data, addr + vring->cur_len, + len - vring->cur_len); } vring->cur_len = len; } |