broadcom: fix issue of ‘addr’ is used uninitialized

This small patch fixes an issue where 'addr' is used uninitialized if
the assert gets removed due to compiling release code and thus
returning uninitialized 'addr'

v2: Modified based on initial review:
    a) No need to initialize the 'addr' and 'ret' variables
    b) Fix 'ret' variable to be proper type based on hw->get_mem return value

v3: Modified based on additional review:
    a) Since both the simulator and mesa have their own version of
'unreachable()' and we cannot use ASSERT for the 'ret' value here,
just use a (void) ret after the assert

Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29434>
This commit is contained in:
Christopher Michael 2024-05-28 10:15:40 -04:00 committed by Marge Bot
parent c1e52baf30
commit fa939898bb

View file

@ -42,7 +42,10 @@ struct v3d_hw *v3d_hw_auto_new(void *in_params)
uint64_t v3d_hw_get_mem(const struct v3d_hw *hw, uint64_t *size)
{
uint64_t addr;
assert(hw->get_mem(&addr, size));
bool ret;
ret = hw->get_mem(&addr, size);
assert(ret);
(void)ret;
return addr;
}