Skip to contentSkip to conversation

atm: atmtcp: Constify atmtcp_v_dev_ops

PATCH Applied Rikard Falkeborn 2 participants 2 messages Sep 27, 2020 – Sep 28, 2020

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

PATCH 1/1 atm: atmtcp: Constify atmtcp_v_dev_ops

The only usage of atmtcp_v_dev_ops is to pass its address to atm_dev_register() which takes a pointer to const, and comparing its address to another address, which does not modify it. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/atm/atmtcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/atm/atmtcp.c +1 -1
index 7f814da3c2d0..96bea1ab1ecc 100644
@@ -327,7 +327,7 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
  */
 
 
-static struct atmdev_ops atmtcp_v_dev_ops = {
+static const struct atmdev_ops atmtcp_v_dev_ops = {
 	.dev_close	= atmtcp_v_dev_close,
 	.open		= atmtcp_v_open,
 	.close		= atmtcp_v_close,
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw

From: Rikard Falkeborn <[email protected]>
Date: Sun, 27 Sep 2020 23:10:42 +0200

Quoted 6 lines

The only usage of atmtcp_v_dev_ops is to pass its address to atm_dev_register() which takes a pointer to const, and comparing its address to another address, which does not modify it. Make it const to allow the compiler to put it in read-only memory.

Applied to net-next