Skip to contentSkip to conversation

net: dsa: microchip: make read-only array ts_reg static const

PATCH In review Colin Ian King 2 participants 2 messages Dec 19, 2025 – Dec 22, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: microchip: make read-only array ts_reg static const

Don't populate the read-only array ts_reg on the stack at run time, instead make it static const.

---
 drivers/net/dsa/microchip/ksz_ptp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/dsa/microchip/ksz_ptp.c +5 -2
index 997e4a76d0a6..839b0202076d 100644
@@ -1088,8 +1088,11 @@ static void ksz_ptp_msg_irq_free(struct ksz_port *port, u8 n)
 
 static int ksz_ptp_msg_irq_setup(struct ksz_port *port, u8 n)
 {
-	u16 ts_reg[] = {REG_PTP_PORT_PDRESP_TS, REG_PTP_PORT_XDELAY_TS,
-			REG_PTP_PORT_SYNC_TS};
+	static const u16 ts_reg[] = {
+		REG_PTP_PORT_PDRESP_TS,
+		REG_PTP_PORT_XDELAY_TS,
+		REG_PTP_PORT_SYNC_TS
+	};
 	static const char * const name[] = {"pdresp-msg", "xdreq-msg",
 					    "sync-msg"};
 	const struct ksz_dev_ops *ops = port->ksz_dev->dev_ops;
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 4 lines · Colin Ian King

Don't populate the read-only array ts_reg on the stack at run time, instead make it static const.

## Form letter - net-next-closed

The net-next tree is closed for new drivers, features, code refactoring and optimizations due to the merge window and the winter break. We are currently accepting bug fixes only.

Please repost when net-next reopens after Jan 2nd.

RFC patches sent for review only are obviously welcome at any time.