Skip to contentSkip to conversation

can: peak_pci: Make structure peak_pciec_i2c_bit_ops constant

PATCH New Nishka Dasgupta 1 participant 1 message Aug 19, 2019

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

PATCH 1/1 can: peak_pci: Make structure peak_pciec_i2c_bit_ops constant

Static structure peak_pciec_i2c_bit_ops, of type i2c_algo_bit_data, is not used except to be copied into another variable. Hence make it const to protect it from modification.
Issue found with Coccinelle.

---
 drivers/net/can/sja1000/peak_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/sja1000/peak_pci.c +1 -1
index 68366d57916c..8c0244f51059 100644
@@ -417,7 +417,7 @@ static void peak_pciec_write_reg(const struct sja1000_priv *priv,
 	peak_pci_write_reg(priv, port, val);
 }
 
-static struct i2c_algo_bit_data peak_pciec_i2c_bit_ops = {
+static const struct i2c_algo_bit_data peak_pciec_i2c_bit_ops = {
 	.setsda	= pita_setsda,
 	.setscl	= pita_setscl,
 	.getsda	= pita_getsda,
Signature · 1 line
2.19.1