All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Vadim Pasternak" <vadimp@nvidia.com>,
	"Karl Mehltretter" <kmehltretter@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Pan Chuang <panchuang@vivo.com>,
	Kees Cook <kees@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] platform/mellanox: mlxbf-tmfifo: fix building with CONFIG_SMP=n
Date: Mon, 28 Sep 2026 16:52:42 +0200	[thread overview]
Message-ID: <20260928145249.3177085-1-arnd@kernel.org> (raw)

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


                 reply	other threads:[~2026-09-28 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928145249.3177085-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kees@kernel.org \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=panchuang@vivo.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vadimp@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.