Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e429d1f authored by Liming Sun's avatar Liming Sun Committed by Greg Kroah-Hartman
Browse files

platform/mellanox: mlxbf-tmfifo: Fix a warning message



[ Upstream commit 99c09c985e5973c8f0ad976ebae069548dd86f12 ]

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: default avatarLiming Sun <limings@nvidia.com>
Link: https://lore.kernel.org/r/20231012230235.219861-1-limings@nvidia.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5f4f58ea
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -588,22 +588,23 @@ 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
		} 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
		} else {
			data = 0;
			memcpy(&data, addr + vring->cur_len,
			       len - vring->cur_len);
		}