Re: [linux-next:master 10570/10862] drivers/net/ethernet/airoha/airoha_eth.c:3470:18: warning: division by zero is undefined

Lorenzo Bianconi <[email protected]> Fri, 31 Jul 2026 17:33:02 +0200
Newsgroups dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all
Message-ID <amzALtFffHRXcefS@lore-desk>
--UEYi+ZA98FZUsaLc
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> On Fri, Jul 31, 2026 at 5:03=E2=80=AFPM Lorenzo Bianconi <lorenzo@kernel.=
org> wrote:
> >
> > Is it a false-positive? I can't see how sizeof((arr)[0]) can be 0 here.
>=20
> `CONFIG_SMP` is not set, so the spinlock is empty, no?

ack, right. We can just use AIROHA_NUM_NETDEV_TX_RINGS instead of ARRAY_SIZ=
E().

diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/etherne=
t/airoha/airoha_eth.c
index dba7c52c0896..64619e9a704d 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -3467,7 +3467,7 @@ static int airoha_alloc_gdm_device(struct airoha_eth =
*eth,
 	netdev->dev.of_node =3D of_node_get(np);
 	dev =3D netdev_priv(netdev);
 	u64_stats_init(&dev->stats.syncp);
-	for (i =3D 0; i < ARRAY_SIZE(dev->txq_lock); i++)
+	for (i =3D 0; i < AIROHA_NUM_NETDEV_TX_RINGS; i++)
 		spin_lock_init(&dev->txq_lock[i]);
 	dev->port =3D port;
 	dev->eth =3D eth;

Regards,
Lorenzo

>=20
> Cheers,
> Miguel

--UEYi+ZA98FZUsaLc
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCamzALgAKCRA6cBh0uS2t
rIj+AP998czAY3FErj3QecQmqgheoFOtcZ5wa/cDA6iyG8UgpAEAlDhfQPBDnZHG
pBHqEVuvCiAcdQsQ78iLgkZ6TgtIkAc=
=hcT8
-----END PGP SIGNATURE-----

--UEYi+ZA98FZUsaLc--