[PATCH][next] net: dsa: rzn1_a5psw: Make the read-only array offsets static const

Colin Ian King posted 1 patch 8 months ago
There is a newer version of this series
drivers/net/dsa/rzn1_a5psw.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH][next] net: dsa: rzn1_a5psw: Make the read-only array offsets static const
Posted by Colin Ian King 8 months ago
Don't populate the read-only array offsets and md5_init on the stack
at run time, instead make it static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/dsa/rzn1_a5psw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 31ea8130a495..df7466d4fe8f 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -337,8 +337,9 @@ static void a5psw_port_rx_block_set(struct a5psw *a5psw, int port, bool block)
 static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port,
 					  bool set)
 {
-	u8 offsets[] = {A5PSW_UCAST_DEF_MASK, A5PSW_BCAST_DEF_MASK,
-			A5PSW_MCAST_DEF_MASK};
+	static const u8 offsets[] = {
+		A5PSW_UCAST_DEF_MASK, A5PSW_BCAST_DEF_MASK, A5PSW_MCAST_DEF_MASK
+	};
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(offsets); i++)
-- 
2.49.0
Re: [PATCH][next] net: dsa: rzn1_a5psw: Make the read-only array offsets static const
Posted by Simon Horman 7 months, 3 weeks ago
On Thu, Apr 17, 2025 at 05:11:06PM +0100, Colin Ian King wrote:
> Don't populate the read-only array offsets and md5_init on the stack
> at run time, instead make it static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Simon Horman <horms@kernel.org>