platform/mellanox: mlxbf-tmfifo: fix building with CONFIG_SMP=n
Subsystems (2)
PATCH 1/1 platform/mellanox: mlxbf-tmfifo: fix building with CONFIG_SMP=n
From: Arnd Bergmann <[email protected]>
spinlock_t is an empty struct, which makes ARRAY_SIZE() on an array of them undefined:
drivers/platform/mellanox/mlxbf-tmfifo.c: In function 'mlxbf_tmfifo_virtio_synchronize_cbs':include/linux/array_size.h:11:38: error: division by zero [-Werror=div-by-zero]
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^drivers/platform/mellanox/mlxbf-tmfifo.c:1146:25: note: in expansion of macro 'ARRAY_SIZE'
1146 | for (i = 0; i < ARRAY_SIZE(fifo->spin_lock); i++) {
| ^~~~~~~~~~Open-code the size of the array here as is done explicitly elsewhere.
Fixes 961d62a3c153 ("platform/mellanox: mlxbf-tmfifo: implement synchronize_cbs()")
Signed-off-by Arnd Bergmann <[email protected]>
--- drivers/platform/mellanox/mlxbf-tmfifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/mellanox/mlxbf-tmfifo.c +1 -1
@@ -1143,7 +1143,7 @@ static void mlxbf_tmfifo_virtio_synchronize_cbs(struct virtio_device *vdev)unsigned long flags;int i; -for (i =0 ; i <ARRAY_SIZE (fifo->spin_lock); i++) { +for (i =0 ; i <2 ; i++) {spin_lock_irqsave (&fifo->spin_lock[i], flags);spin_unlock_irqrestore (&fifo->spin_lock[i], flags); }
Signature · 1 line
2.53.0