mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/mellanox: mlxbf-tmfifo: fix building with CONFIG_SMP=n
@ 2026-09-28 14:52 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2026-09-28 14:52 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen, Vadim Pasternak,
	Karl Mehltretter, Michael S. Tsirkin
  Cc: Arnd Bergmann, Pan Chuang, Kees Cook, platform-driver-x86, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 drivers/platform/mellanox/mlxbf-tmfifo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c
index d67215df7371..dc4060c720f8 100644
--- a/drivers/platform/mellanox/mlxbf-tmfifo.c
+++ b/drivers/platform/mellanox/mlxbf-tmfifo.c
@@ -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);
 	}
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-28 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 14:52 [PATCH] platform/mellanox: mlxbf-tmfifo: fix building with CONFIG_SMP=n Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®